[ 'App\Listeners\EventListener', ], ]; /** * Register any other events for your application. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function boot(DispatcherContract $events) { parent::boot($events); \App\Product::saving(function ($product) { $manufacturer = \App\Manufacturer::find($product->manufacturer_id); $product->slug = str_slug($manufacturer->title) . '-' . str_slug($product->title); }); } }