/** * Display a listing of the resource. * GET /subcategories * * @return Response */ public function index() { $subCategory = new SubCategory(); $subCategory->name = Request::get('name'); $subCategory->description = Request::get('description'); $subCategory->category_id = Request::get('category_id'); //$category->user_id = Auth::user()->id; // Validation and Filtering is sorely needed!! // Seriously, I'm a bad person for leaving that out. if (Auth::user()->id == 1) { $subCategory->save(); return Response::json(array('error' => false, 'categories' => $subCategory->toArray()), 200); } else { return Response::json(array('error' => true, 'reason' => 'Error with user id' . Auth::user()->id), 200); } }