/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $status = Status::findOrFail($this->input('id')); if (Auth::user()->id == $status->user_id || Auth::user()->can('manage_statuses')) { return true; } else { return false; } }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $status = Status::findOrFail($this->input('status_id')); if (Auth::check()) { return true; } else { return false; } }
public function delete(DeleteStatus $request, $id) { $status = Status::findOrFail($id); $user = $status->user; //Ištrina būsenos atnaujinimą. $status->delete(); event(new StatusWasDeleted($status, $status->user)); flash()->success('Būsenos atnaujinimas sėkmingai ištrintas'); return redirect()->route('user.show', $user->slug); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $user = Auth::user(); $status = Status::findOrFail($this->route('id')); if ($user && ($status->user_id == $user->id || $user->can('manage_statuses'))) { return true; } else { return false; } }