コード例 #1
0
 public function run()
 {
     $root = Category::create(['name' => 'test_root', 'slug' => 'test_root']);
     $root->save();
     $child = Category::create(['name' => 'test', 'slug' => 'test']);
     $child->save();
     $child->makeChildOf($root);
 }
コード例 #2
0
ファイル: HlogeonPageSeeder.php プロジェクト: hlogeon/scms
 public function run()
 {
     $faker = Faker\Factory::create('ru_RU');
     $category = Category::all()->first();
     $type = Type::all()->first();
     $page = Page::create(['in_menu' => false, 'published' => true, 'sidebar_in_layout' => false, 'title' => $faker->word, 'content' => $faker->paragraphs(), 'type_id' => $type]);
     $page->save();
     $page->category()->attach($category);
 }