public function run() { $array = array(['title' => 'Artikel', 'slug' => 'uncategorized']); foreach ($array as $item) { Postcategory::create($item); } }
/** * Store a newly created Postcategory in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Postcategory::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } Postcategory::create($data); return Redirect::route('admin.categories.index'); }