'', 'name' => '', 'slug' => '', 'picture' => '', 'description' => '', 'preparation' => '', 'ingredients' => [], 'portions' => '', 'difficulty' => [ 'label' => 'none', 'value' => 0 ], 'preparation_time' => '', 'cooking_time' => '', ]; /** * RecipeResource * * @param \App\Models\Recipe $recipe * @return void */ public function __construct(Recipe $recipe) { $this->recipe = $recipe; } /** * Transform the resource into an array. * * @param \Illuminate\Http\Request|null $request * @return array * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function toArray(?Request $request = null): array { // phpcs:enable return array_intersect_key( [ 'id' => $this->recipe->id, 'name' => $this->recipe->name, 'slug' => $this->recipe->slug, 'picture' => $this->recipe->picture, 'description' => $this->recipe->description, 'preparation' => $this->recipe->preparation, 'ingredients' => $this->recipe->ingredients, 'portions' => $this->recipe->portions, 'difficulty' => $this->recipe->difficulty, 'preparation_time' => $this->recipe->preparation_time, 'cooking_time' => $this->recipe->cooking_time, ], $this->getSkeleton() ); } /** * Returns the resource skeletton * * @return array */ public static function getSkeleton(): array { return self::$skeleton; } }