/** * @param ProductRequest $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function product_create(ProductRequest $request) { // product::create(Request::all()); // product::create($request->all()); return redirect('add-product'); }
public function run() { DB::table('products')->truncate(); $faker = Factory::create(); $categories = categorie::all()->lists('id'); foreach (range(1, 50) as $index) { product::create(['name' => $faker->sentence(4), 'categorie_id' => $faker->randomElement($categories), 'description' => $faker->text, 'price' => $faker->randomFloat(2, 2, 200), 'slug' => $faker->slug]); } }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); // $this->call(UserTableSeeder::class); user::create(['username' => 'puah', 'email' => '*****@*****.**']); user::create(['username' => 'yan', 'email' => '*****@*****.**', 'user_role' => 'admin']); product::create(['productname' => 'clothyan', 'product_price' => '50.00', 'quantity' => '10', 'product_desc' => 'this is good cloth']); product::create(['productname' => 'clothyan2', 'product_price' => '52.00', 'quantity' => '12']); Model::reguard(); }
public function store() { $input = Request::all(); product::create($input); return redirect('add-product'); }