complete Complete User Request Submission section RAD-1
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
|
||||
use App\Models\Permission;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
|
||||
class PermissionExport implements FromCollection
|
||||
{
|
||||
|
||||
protected $filters;
|
||||
|
||||
public function __construct($filters = [])
|
||||
{
|
||||
$this->filters = $filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
return Permission::when(isset($request->search) , function ($query){
|
||||
$query->where(function ($q) {
|
||||
$q->where('name', 'LIKE', "%{$this->filters['search']}%")
|
||||
->orWhere('label','LIKE', "%{$this->filters['search']}%");
|
||||
});
|
||||
})
|
||||
->latest()
|
||||
->get();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user