/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { if (!parent::authorize()) { return false; } if ($this->blog) { if ($this->user()->isAdmin()) { return true; } return Post::where('id', $this->blog)->where('user_id', $this->user()->id)->exists(); } return true; }