mirror of https://github.com/movim/movim
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
523 B
24 lines
523 B
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Movim\Image;
|
|
|
|
class Sticker extends Model
|
|
{
|
|
public function pack()
|
|
{
|
|
return $this->belongsTo(StickersPack::class, 'name', 'pack');
|
|
}
|
|
|
|
public function getImagePathAttribute(): string
|
|
{
|
|
return PUBLIC_STICKERS_PATH . '/' . $this->attributes['pack'] . '/' . $this->attributes['filename'];
|
|
}
|
|
|
|
public function getUrlAttribute(): string
|
|
{
|
|
return Image::getOrCreate($this->attributes['cache_hash']);
|
|
}
|
|
}
|