72 lines
1.6 KiB
PHP
72 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Exports;
|
|
|
|
use App\Models\ManageRestaurant;
|
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
|
|
|
|
class RestaurantExportSelected implements FromCollection, WithHeadings
|
|
{
|
|
protected $ids;
|
|
|
|
public function __construct($ids)
|
|
{
|
|
$this->ids = $ids;
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Support\Collection
|
|
*/
|
|
public function collection()
|
|
{
|
|
|
|
$selectedCareIds = explode(',', $this->ids);
|
|
|
|
$selected_restaurant = ManageRestaurant::whereIn('id', $selectedCareIds)
|
|
->orderBy('id', 'Desc')
|
|
->select(
|
|
'id',
|
|
'name',
|
|
// 'description',
|
|
'phone_number',
|
|
'restaurant_id',
|
|
'address',
|
|
'bio',
|
|
'try_on_1',
|
|
'try_on_2',
|
|
'try_on_3',
|
|
'try_on_4',
|
|
'exclusion',
|
|
'latitude',
|
|
'longtitude',
|
|
'is_active'
|
|
)
|
|
->get();
|
|
return $selected_restaurant;
|
|
}
|
|
|
|
//function header in excel
|
|
public function headings(): array
|
|
{
|
|
return [
|
|
'Id',
|
|
'Restaurant Name',
|
|
// 'Description',
|
|
'Phone Number',
|
|
'Restaurant Id',
|
|
'Address',
|
|
'Bio',
|
|
'Try on 1',
|
|
'Try on 2',
|
|
'Try on 3',
|
|
'Try on 4',
|
|
'Exclusion',
|
|
'Latitude',
|
|
'Longitude',
|
|
'Active staus'
|
|
];
|
|
}
|
|
}
|