Exemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CategoryRequest $req)
 {
     $category = new Category();
     $category->category = $req->input('category');
     $category->save();
     return redirect('admin/category')->with('message', ['class' => 'success', 'message' => 'Category added.']);
 }
Exemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //Model::unguard();
     $user = new User();
     $user->name = 'Vaidas';
     $user->email = '*****@*****.**';
     $user->password = bcrypt('123456');
     $user->is_admin = 1;
     $user->save();
     $category = new Category();
     $category->slug = 'sports';
     $category->category = 'Sports';
     $category->save();
     $category = new Category();
     $category->slug = 'nature';
     $category->category = 'Nature';
     $category->save();
     $category = new Category();
     $category->slug = 'politics';
     $category->category = 'Politics';
     $category->save();
     //Model::reguard();
 }