/** * Handle the event. * * @param ProjectCreated $event * @return void */ public function handle(ProjectCreated $event) { $lookup = new DependencyLookup(); $lookup->subject_type = 'Project'; $lookup->subject_id = $event->project->id; $lookup->subject_name = $event->project->name; $lookup->save(); }
/** * Handle the event. * * @param ActionCreated $event * @return void */ public function handle(ActionCreated $event) { $lookup = new DependencyLookup(); $lookup->subject_type = 'Action'; $lookup->subject_id = $event->action->id; $lookup->subject_name = $event->action->title; $lookup->save(); }
/** * Handle the event. * * @param WorkStreamCreated $event * @return void */ public function handle(WorkStreamCreated $event) { $lookup = new DependencyLookup(); $lookup->subject_type = 'WorkStream'; $lookup->subject_id = $event->workstream->id; $lookup->subject_name = $event->workstream->name; $lookup->save(); }
/** * Handle the event. * * @param RiskCreated $event * @return void */ public function handle(RiskCreated $event) { $risk = $event->risk; $lookup = new DependencyLookup(); $lookup->subject_type = 'Risk'; $lookup->subject_id = $risk->id; $lookup->subject_name = $risk->title; $lookup->save(); }
/** * Handle the event. * * @param ProjectUpdated $event * @return void */ public function handle(ProjectUpdated $event) { //check if the name is dirty if ($event->project->IsDirty('name')) { //if dirty update the dependency lookup date $lookup = DependencyLookup::where('subject_type', 'Project')->where('subject_id', $event->project->id)->first(); $lookup->subject_name = $event->project->name; $lookup->save(); } }
/** * Handle the event. * * @param ActionUpdated $event * @return void */ public function handle(ActionUpdated $event) { //check if the name is dirty if ($event->action->IsDirty('title')) { //if dirty update the dependency lookup date $lookup = DependencyLookup::where('subject_type', 'Action')->where('subject_id', $event->action->id)->first(); $lookup->subject_name = $event->action->title; $lookup->save(); } }
public function getDependentLookup(Request $request) { $items = DependencyLookup::select('subject_id as id', 'subject_name as text', 'subject_type')->where('subject_name', 'like', '%' . $request->input('q') . '%')->get(); return response()->json($items); }