Pass data:
return redirect()->route('admin.article.index')->with('results', $results);
Get data:
session('results');
Pass data:
return redirect()->route('admin.article.index')->with('results', $results);
Get data:
session('results');
/** | |
* Class CsvHelpers | |
* @package App\Services\Common | |
*/ | |
class CsvHelpers | |
{ | |
/** | |
* @param $file | |
* @return string | |
*/ |
If you have a large CSV file, you very likely can't store it all in an array in memory before you start inserting the data into the DB, so you need to be inserting the data in chunks as you read it from the CSV file.
You would be lost the data if the process unfortinately broken.
You should know why it is broken. :)
As of MySQL 5.7.5, the default SQL mode includes ONLY_FULL_GROUP_BY which means when you are grouping rows and then selecting something out of that groups, you need to explicitly say which row should that selection be made from.
Fixing:
$ sudo vim /etc/mysql/my.cnf
Add them to bottom of file
$product->whereRaw("strftime('%Y-%m', created_at) = '2010-1'")->get(); |
$ mysqldump --all-databases > all_databases.sql
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.1-1_all.deb
Choose version 5.7 -> OK
str = str.toLowerCase(); | |
str = str.replace(/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/g, 'a'); | |
str = str.replace(/(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)/g, 'e'); | |
str = str.replace(/(ì|í|ị|ỉ|ĩ)/g, 'i'); | |
str = str.replace(/(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)/g, 'o'); | |
str = str.replace(/(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)/g, 'u'); | |
str = str.replace(/(ỳ|ý|ỵ|ỷ|ỹ)/g, 'y'); | |
str = str.replace(/(đ)/g, 'd'); |
echo round((memory_get_usage() / 1024 / 1024, 2) . ' MB' . PHP_EOL; |