improved tenant identification
This commit is contained in:
@@ -4,8 +4,12 @@ namespace App\Abstracts;
|
||||
|
||||
use App\Events\Export\HeadingsPreparing;
|
||||
use App\Events\Export\RowsPreparing;
|
||||
use App\Notifications\Common\ExportFailed;
|
||||
use App\Utilities\Date;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
use Illuminate\Support\Str;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
@@ -13,16 +17,21 @@ use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\Date as ExcelDate;
|
||||
|
||||
abstract class Export implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
abstract class Export implements FromCollection, HasLocalePreference, ShouldAutoSize, ShouldQueue, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
public $ids;
|
||||
|
||||
public $fields;
|
||||
|
||||
public $user;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
$this->fields = $this->fields();
|
||||
$this->user = user();
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
@@ -74,4 +83,14 @@ abstract class Export implements FromCollection, ShouldAutoSize, WithHeadings, W
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function preferredLocale()
|
||||
{
|
||||
return $this->user->locale;
|
||||
}
|
||||
|
||||
public function failed(\Throwable $exception): void
|
||||
{
|
||||
$this->user->notify(new ExportFailed($exception));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user