/** * Execute the command. * * @return void */ public function handle() { \Log::info('[' . $this->job->getJobId() . ':' . $this->attempts() . '] Category assignment started.'); $category = Category::find($this->cat_id); $projects = Project::all(); foreach ($projects as $project) { $project->assignCategory($category); } \Log::info('[' . $this->job->getJobId() . ':' . $this->attempts() . '] Category assignment completed.'); }
/** * Remove the specified resource from storage. * * @param int $id * * @return Response */ public function destroy($id) { Category::find($id)->delete(); return response()->json(array('error' => false, 'message' => 'Category deleted.'), 200); }