예제 #1
0
 public static function get_form_list()
 {
     $author = Authors::all(['id', 'name']);
     foreach ($author as $k) {
         $authors[$k->id] = $k->name;
     }
     return $authors;
 }
예제 #2
0
 public function run()
 {
     // CLEAR TABLE BOOKS
     Books::truncate();
     // SEEDS EXECUTE
     $Authors = Authors::all()->each(function ($author) {
         foreach (range(1, 10) as $v) {
             $category = Category::all(['id'])->random(1);
             $author->books()->save(factory('App\\Books')->make(['category_id' => $category->id]));
         }
     });
 }