27 lines
642 B
PHP
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,
|
|
];
|
|
|
|
|
|
}
|
|
}
|