My Laravel
Monday, December 23, 2019
Useful Laravel Packages(Andre Madarang)
https://codewithdre.com/useful-laravel-packages
Useful Laravel Packages
A comprehensive video course teaching you how to use the most popular Laravel packages to jump-start your web applications.
Maatwebsite Laravel-Excel document
https://docs.laravel-excel.com/3.1/imports/collection.html
Importing to collections
The easiest way to start an import is to create a custom import class. We'll use a user import as example.
Create a new class called UsersImport in app/Imports:
namespace App\Imports;
use App\User;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
class UsersImport implements ToCollection
{
public function collection(Collection $rows)
{
foreach ($rows as $row)
{
User::create([
'name' => $row[0],
]);
}
}
}
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)