/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, ['name' => 'required|string', 'start_date' => 'required|date_format:d/m/Y', 'end_date' => 'required|date_format:d/m/Y']); Event::create($request->all()); flash()->success('Success!', "New event has been created!"); return redirect(route('admin.settings.events.index')); }
/** * Run the database seeds. * * @return void */ public function run() { Event::create(['name' => "2015 Fishing Festival", 'start_date' => (new Carbon("2015-09-04"))->format("d/m/Y"), 'end_date' => (new Carbon("2015-09-13"))->format("d/m/Y"), 'notes' => '2015 Festival notes.']); Event::create(['name' => "2016 Fishing Festival", 'start_date' => (new Carbon())->subMonth()->format("d/m/Y"), 'end_date' => (new Carbon())->addMonth()->format("d/m/Y"), 'notes' => 'Best fishing festival ever!!!']); }