Skip to content

Instantly share code, notes, and snippets.

@endihunter
Created February 6, 2017 14:00
Show Gist options
  • Save endihunter/5ae7d1c7a0f1e7f1f1aa508ce7bc6ee2 to your computer and use it in GitHub Desktop.
Save endihunter/5ae7d1c7a0f1e7f1f1aa508ce7bc6ee2 to your computer and use it in GitHub Desktop.
scaffolding delete method
<?php
public function delete(Module $module)
{
$this->authorize('delete', $eloquent = app('scaffold.model'));
app('scaffold.actions')->exec('delete', [$eloquent]);
$message = trans('administrator::messages.remove_success');
if (URL::previous() == route('scaffold.view', ['module' => $module, 'id' => $eloquent->id])) {
return redirect()->to($this->getPreviousUrl())->with('messages', [$message]);
}
return redirect()->to(route('scaffold.index', ['module' => $module]))->with('messages', [$message]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment