response = Gate::inspect('create', WatchHistory::class))->allowed(); } /** * The base return type of the query. */ public function baseType(): WatchHistoryType { return new WatchHistoryType(); } /** * @param array $args * @param StoreAction $action */ public function resolve($root, array $args, $context, ResolveInfo $resolveInfo, StoreAction $action): WatchHistory { $validated = Validator::make($args, $this->rulesForValidation($args))->validated(); $validated = [ WatchHistory::ATTRIBUTE_ENTRY => Arr::integer($validated, 'entryId'), WatchHistory::ATTRIBUTE_VIDEO => Arr::integer($validated, 'videoId'), WatchHistory::ATTRIBUTE_USER => Auth::id(), ]; return $action->store(WatchHistory::query(), $validated); } }