/** * Store a newly created resource in storage. * * @param \App\Requests\riskRequest $request * @return \Illuminate\Http\Response */ public function store(AttackRequest $request, $risk) { $this->authorize('append', $risk); $new_attack = new Attack($request->all()); $new_attack->risk()->associate($risk)->save(); $new_attack->syncTags($request->input('tags')); return redirect()->route('tree.show', [$risk->tree])->with('succes', 'Attack successfully created'); }
/** * Bootstrap any application services. * * @return void */ public function boot() { \App\Attack::observe(new \App\Observers\AttackObserver()); \App\Defence::observe(new \App\Observers\DefenceObserver()); \App\Risk::observe(new \App\Observers\RiskObserver()); \App\Tree::observe(new \App\Observers\TreeObserver()); \App\User::observe(new \App\Observers\UserObserver()); }