public function run()
 {
     $uncategorized = DB::table('categories')->where('slug', 'uncategorized')->get();
     if (count(DB::table('categories')->get()) == 0 && empty($uncategorized)) {
         Category::create(['title' => 'Uncategorized', 'description' => 'Default category', 'slug' => 'uncategorized']);
     }
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created category in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Category::$rules);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     Category::create($data);
     return redirect()->route('admin.categories.index');
 }