sarga/packages/Webkul/Core/src/Models/Slider.php

41 lines
795 B
PHP
Raw Normal View History

<?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;
2019-02-18 07:30:40 +00:00
class Slider extends Model implements SliderContract
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $table = 'sliders';
protected $fillable = [
2019-03-11 13:13:06 +00:00
'title', 'path', 'content', 'channel_id'
];
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();
}
}