public function destroy($id) { if (Auth::user()->can('delete-status')) { $status = AgreementStatus::findOrFail($id); AgreementStatus::destroy($id); Session::flash('message', trans('agreement::ui.status.message_delete', array('name' => $status->name))); return redirect('agreement/status'); } 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'); }