示例#1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $categoryLeaves = Category::where("real_depth", '=', 2)->get()->toArray();
     $faker = new Faker\Generator();
     $faker->addProvider(new Faker\Provider\Lorem($faker));
     $users = User::all();
     foreach ($users as $user) {
         for ($i = 0; $i < $this->numPatches(); $i++) {
             $category = $categoryLeaves[array_rand($categoryLeaves)];
             $patch = Patch::create(["name" => $faker->sentence(6, true), "user_id" => $user->id, "description" => $faker->paragraph(3, true), "category_id" => $category["id"]]);
             $this->generateDownloads($users, $patch);
             $this->generateVotes($users, $patch);
         }
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $rootCategory = Category::create(["name" => "All"]);
     $c = Category::create(["name" => "Logic Studio"]);
     $rootCategory->addChild($c);
     $cc = Category::create(["name" => "Platinum Reverb"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Space Designer"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Compressor"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Platinum Delay"]);
     $c->addChild($cc);
     $c = Category::create(["name" => "Line 6 Pod Farm"]);
     $rootCategory->addChild($c);
     $cc = Category::create(["name" => "Power Pack"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Metal Shop"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "FX Junkie"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Collector Classics"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Bass Expansion"]);
     $c->addChild($cc);
     $c = Category::create(["name" => "AxeFx II"]);
     $rootCategory->addChild($c);
     $cc = Category::create(["name" => "Impulse Responses"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Amp Settings"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "FX Settings"]);
     $c->addChild($cc);
     $c = Category::create(["name" => "Superior Drummer 2.0"]);
     $rootCategory->addChild($c);
     $cc = Category::create(["name" => "Custom & Vintage SDX"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Indiependent SDX"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Metal Machinery SDX"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Music City USA SDX"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "New York Avatar SDX"]);
     $c->addChild($cc);
     $cc = Category::create(["name" => "Metal Foundry SDX"]);
     $c->addChild($cc);
 }
 public function categories()
 {
     return Category::getTree(['*'], ['patchCount'])->first()->toJson();
 }