0
0
Files
Babyclass/app/Api/Resources/AdvertIndexResource.php
2020-08-04 10:09:42 +08:00

27 lines
642 B
PHP

<?php
namespace App\Api\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class AdvertIndexResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id'=>$this->id,
'link'=> $this->hide_url == 0 ? $this->advertable->link() : '',
'img' => $this->storage_id ? $this->storage ? 'http://www.bohaimingpin.com'.$this->storage->path : '' : 'http://www.bohaimingpin.com'.$this->advertable->storage->path,
];
}
}