1 | <?php |
||
2 | |||
3 | namespace App\Http\Resources; |
||
4 | |||
5 | use App\Services\TenantManager; |
||
6 | use Illuminate\Http\Resources\Json\JsonResource; |
||
7 | |||
8 | class SourceResource extends JsonResource |
||
9 | { |
||
10 | /** |
||
11 | * @var TenantManager |
||
12 | */ |
||
13 | protected static $tenantManager; |
||
14 | |||
15 | public static function setTenantManager($tenantManager) |
||
16 | { |
||
17 | self::$tenantManager = $tenantManager; |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * Transform the resource into an array. |
||
22 | * |
||
23 | * @param \Illuminate\Http\Request $request |
||
24 | * |
||
25 | * @return array |
||
26 | */ |
||
27 | public function toArray($request) |
||
28 | { |
||
29 | $array = parent::toArray($request); |
||
30 | $array['url'] = config('app.apply_url').'/'.static::$tenantManager->getTenant()->subdomain.'/'.$array['key'] |
||
31 | .'-'.preg_replace("/[^A-Za-z0-9\-]/", '', str_replace(' ', '-', $this->recruitment->job_title)); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
32 | |||
33 | return $array; |
||
0 ignored issues
–
show
|
|||
34 | } |
||
35 | } |
||
36 |