public function destroy($id)
 {
     if (Auth::user()->can('delete-clients')) {
         $client = Client::findOrFail($id);
         Client::destroy($id);
         Session::flash('message', trans('client::ui.client.message_delete', array('name' => $client->firstname . ' ' . $client->lastname)));
         return redirect('client');
     }
     return redirect('auth/logout');
 }
 public function edit($id)
 {
     if (Auth::user()->can('update-agreements')) {
         $agreement = Agreement::findOrFail($id);
         $clients = Client::orderBy('lastname', 'asc')->lists('lastname', 'id');
         $cars = Car::orderBy('sheet_number', 'asc')->lists('sheet_number', 'id');
         $status = AgreementStatus::orderBy('name', 'asc')->lists('name', 'id');
         return view('agreement::edit', compact('agreement', 'clients', 'cars', 'status'));
     }
     return redirect('auth/logout');
 }
Example #3
0
 public function trashed()
 {
     if (Auth::user()->can('trashed-clients')) {
         Client::onlyTrashed();
     }
 }