/** * Run the database seeds. * * @return void */ public function run() { $archives = Archive::all(); $count = $archives->count(); foreach (range(0, 299) as $i) { $comment = new Comment(); $comment->nickname = str_random(4); $comment->archive_id = rand(1, $count); $comment->content = str_random(8) . ' ' . str_random(8); $comment->save(); } }
/** * 分类管理页面首页 * */ public function index() { return view('admin.archive.index')->withArchives(Archive::all()); }