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.
 
 
 
 

36 lines
826 B

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Movim\Image;
class Emoji extends Model
{
protected $table = 'emojis';
public function users()
{
return $this->belongsToMany('App\Users')->withTimestamps();
}
public function pack()
{
return $this->belongsTo('App\EmojisPack', 'name', 'pack');
}
public function getImagePathAttribute(): string
{
return PUBLIC_EMOJIS_PATH . '/' . $this->attributes['pack'] . '/' . $this->attributes['filename'];
}
public function getUrlAttribute(): string
{
return Image::getOrCreate($this->attributes['cache_hash']);
}
public function getAliasPlaceholderAttribute(): string
{
return slugify(str_replace($this->attributes['pack'], '', $this->attributes['name']));
}
}