N
N
NubasLol2018-10-22 12:33:30
Laravel
NubasLol, 2018-10-22 12:33:30

Maatwebsite/Laravel-Excel how to get sheet title in import class?

There is nothing in the docks, I need to do something like this:

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],
                'date'=> название листа
            ]);
        }
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question