Issues (185)

app/Http/Resources/SourceResource.php (2 issues)

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
The property recruitment does not exist on App\Http\Resources\SourceResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
32
33
        return $array;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $array also could return the type Illuminate\Contracts\Sup...ayable|JsonSerializable which is incompatible with the documented return type array.
Loading history...
34
    }
35
}
36