/** * Run the database seeds. * * @return void */ public function run() { $faker = \Faker\Factory::create(); TodoList::truncate(); foreach (range(1, 50) as $index) { TodoList::create(['name' => $faker->sentence(2), 'description' => $faker->sentence(5), 'complete' => false]); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $this->validate($request, ['name' => 'required', 'description' => 'required']); TodoList::create(['name' => $request->name, 'description' => $request->description, 'complete' => $request->complete || 0]); return redirect()->action('ListsController@index'); }