namespace App\Exports;
use App\User;
use Maatwebsite\Excel\Concerns\FromCollection;
class UsersExport implements FromCollection
{
public function collection()
{
return User::all();
}
}
namespace App\Exports;
use App\User;
use Maatwebsite\Excel\Concerns\FromCollection;
class UsersExport implements FromCollection
{
public function collection()
{
return User::all();
}
}
namespace App\Imports;
use App\User;
use Maatwebsite\Excel\Concerns\ToModel;
class UsersImport implements ToModel
{
public function model(array $row)
{
return new User([
'email' => $row[1],
]);
}
}
namespace App\Nova;
use Maatwebsite\LaravelNovaExcel\Actions\DownloadExcel;
class User extends Resource
{
public function actions(Request $request)
{
return [
(new DownloadExcel)->withHeadings(),
];
}
}