/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('brands')->truncate();
     $faker = Faker::create();
     foreach (range(1, 20) as $index) {
         Brand::create(['name' => "Brand " . $index, 'brand_owner_id' => BrandOwner::find($faker->numberBetween(1, 20))->id, 'industry_id' => Industry::find($faker->numberBetween(1, 20))->id]);
     }
 }
Esempio n. 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(BrandRequest $request)
 {
     try {
         $brand = Brand::create($request->all());
         return $request->request->get('continue') ? $this->redirectBackWithMessage('操作成功') : redirect('brand');
     } catch (BaseException $e) {
     }
 }
Esempio n. 3
0
 public function store(Request $request, $merchant_model, $address_model)
 {
     //may be we get more that brands so loop through brand_name[] in request
     //create record for each brand
     //then save one by one and save in model array brand_models_array
     $brand_name_array = $request->get('brand_name');
     $brandRecords[] = ['name' => null, 'description' => null, 'logo' => null, 'deleted' => null];
     //all website records
     $brand_models[] = null;
     foreach ($brand_name_array as $brand_name) {
         $brandRecords[] = $this->collectBrandFormData($request, $brand_name);
     }
     unset($brandRecords[0]);
     $brand = new Brand();
     foreach ($brandRecords as $brandRecord) {
         $brand_models[] = $brand->create($brandRecord);
     }
     unset($brand_models[0]);
     return $brand_models;
 }
 public function store(Request $request)
 {
     Brand::create($request->all());
     return redirect(route('admin.brand.index'));
 }
Esempio n. 5
0
 public function store(Request $request)
 {
     //        return $request->all();
     Brand::create($request->all());
     return redirect(route('admin.brand.index'))->with('info', '新增品牌成功~');
 }
Esempio n. 6
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     \App\Models\Brand::create(['name' => $request->get('name'), 'description' => $request->get('description'), 'site_url' => $request->get('site_url')]);
     return redirect('/admin/brand');
 }