/** * Bootstrap any application services. * * @return void */ public function boot() { \App\Project::observe(new \App\Observers\ActivityObserver()); \App\Task::observe(new \App\Observers\ActivityObserver()); \App\Activity::creating(function ($activity) { $activity->user()->associate(auth()->user()); }); }
/** * Register any other events for your application. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function boot(DispatcherContract $events) { parent::boot($events); // register the ProjectObserver class. Client::observe(new ClientObserver()); // register the ProjectObserver class. Project::observe(new ProjectObserver()); // register the WorkTypeObserver class. WorkType::observe(new WorkTypeObserver()); // register the TimeCardFormatObserver class. TimeCardFormat::observe(new TimeCardFormatObserver()); // register the WorkObserver class. Work::observe(new WorkObserver()); // register the TimeCardObserver class. TimeCard::observe(new TimeCardObserver()); // register the TimeCardHoursWorkedObserver class. TimeCardHoursWorked::observe(new TimeCardHoursWorkedObserver()); // register the TaskTypeObserver class. TaskType::observe(new TaskTypeObserver()); // register the TaskObserver class. Task::observe(new TaskObserver()); }