Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $data = ['Whole Foods', 'Shaws', "Russo's", 'Fish Monger'];
     foreach ($data as $storeName) {
         $store = new \App\Store();
         $store->name = $storeName;
         $store->save();
     }
 }
Ejemplo n.º 2
0
 public function postCreateStore(Request $request)
 {
     //Validate the request for the required feilds
     $this->validate($request, ['store_name' => 'required']);
     //get the store name from request and add to the database
     $store = new \App\Store();
     $store->store_name = $request->store_name;
     $store->save();
     //Adding data to related pivote table
     $store->users()->attach(\Auth::id());
     //show the flash message and redirect page
     \Session::flash('flash_message', 'New Store "' . $store->store_name . '" is Created in the list!');
     return redirect('/store');
 }