*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'name' => $this->name, 'slug' => $this->slug, 'description' => $this->description, 'is_active' => $this->is_active, 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), // Include relationships when loaded $this->mergeWhen($this->relationLoaded('relationships'), [ // Add relationship data here ]), ]; } /** * Get additional data that should be returned with the resource array. * * @return array */ public function with(Request $request): array { return [ 'meta' => [ 'model' => 'Manufacturer', 'generated_at' => now()->toISOString(), ], ]; } }