$recipe->author()->first(), 'tags' => $recipe->tags()->get(), 'recipe' => $recipe, ]; $expiresAt = now()->addHours(24); views($recipe) ->cooldown($expiresAt) ->record(); return view('recipe/show', $data); } public function edit(Recipe $recipe): View|ViewFactory { if (! $this->canEditRecipe($recipe)) { abort(403, 'Unauthorized action.'); } return view('recipe/edit_form', ['recipe' => $recipe]); } private function canEditRecipe(Recipe $recipe): bool { return Gate::allows('edit', $recipe); } }