2018-08-03 14:50:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Webkul\Core\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2019-03-11 13:13:06 +00:00
|
|
|
use Illuminate\Support\Facades\Storage;
|
2019-02-18 07:30:40 +00:00
|
|
|
use Webkul\Core\Contracts\Slider as SliderContract;
|
2018-08-03 14:50:13 +00:00
|
|
|
|
2019-02-18 07:30:40 +00:00
|
|
|
class Slider extends Model implements SliderContract
|
2018-08-03 14:50:13 +00:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
2018-08-08 13:47:40 +00:00
|
|
|
protected $table = 'sliders';
|
|
|
|
|
|
2018-08-03 14:50:13 +00:00
|
|
|
protected $fillable = [
|
2019-03-11 13:13:06 +00:00
|
|
|
'title', 'path', 'content', 'channel_id'
|
2018-08-03 14:50:13 +00:00
|
|
|
];
|
2019-03-11 13:13:06 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get image url for the category image.
|
|
|
|
|
*/
|
|
|
|
|
public function image_url()
|
|
|
|
|
{
|
2020-02-19 12:26:12 +00:00
|
|
|
if (! $this->path) {
|
2019-03-11 13:13:06 +00:00
|
|
|
return;
|
2020-02-19 12:26:12 +00:00
|
|
|
}
|
2019-03-11 13:13:06 +00:00
|
|
|
|
|
|
|
|
return Storage::url($this->path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get image url for the category image.
|
|
|
|
|
*/
|
|
|
|
|
public function getImageUrlAttribute()
|
|
|
|
|
{
|
|
|
|
|
return $this->image_url();
|
|
|
|
|
}
|
2018-08-03 14:50:13 +00:00
|
|
|
}
|