improved tenant identification

This commit is contained in:
Denis Duliçi
2021-04-16 00:59:43 +03:00
parent 9635e6be5d
commit 2b07442260
126 changed files with 1719 additions and 999 deletions

View File

@@ -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));
}
}