Example #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //Truncate
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     User::truncate();
     Admin::truncate();
     Customer::truncate();
     Address::truncate();
     Category::truncate();
     Product::truncate();
     Brand::truncate();
     Type::truncate();
     Image::truncate();
     DB::statement('TRUNCATE category_product;');
     Product::clearIndices();
     Product::reindex();
     //Unguard
     Model::unguard();
     //Call
     $this->call(UsersTableSeeder::class);
     $this->call(ProductsTableSeeder::class);
     //Reguard
     Model::reguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Product::destroy($id);
     Product::reindex();
     return;
 }