/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $this->user = JWTAuth::parseToken()->authenticate(); $chatId = $this->route('chat'); $chat = Chat::findOrFail($chatId); if ($chat) { return $chat->users()->whereUserId($this->user->id)->whereType('admin')->exists(); } }