Files
Gw0bm/app/Models/Icon.php
2021-06-20 13:49:07 +00:00

36 lines
789 B
PHP
Executable File

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Icon extends Model
{
public $timestamps = false;
public function roles() {
return $this->hasMany(Role::class);
}
public function users() {
return $this->hasMany(User::class);
}
public function toJson($options = 0) {
return parent::toJson($options);
}
public function __toString() {
switch ($this->icon_type) {
case 'fa':
return '<i class="fa fa-' . $this->icon . '"></i>';
case 'img':
case 'image':
return '<img class="icon" src="https://w0bm.com/' . ltrim($this->icon, '/') . '" alt="' . $this->icon . '">';
default:
return '';
}
}
}