Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function import(Request $request)
- {
- $excel_file = $request->file('excel_file');
- $validator = Validator::make($request->all(), [
- 'excel_file' => 'required'
- ]);
- if($validator->fails()) {
- return Redirect::to('/')->withErrors($validator);
- }
- $fname = md5(rand()) . '.csv';
- $full_path = 'files';
- $excel_file->move($full_path, $fname);
- $flag_table = Flag::firstOrNew(['file_name' => $fname]);
- $flag_table->imported = 0;
- $flag_table->save();
- Artisan::queue('import:excelfile');
- return 'File importing is on the way';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement