mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 10:49:10 -04:00
33 lines
554 B
PHP
33 lines
554 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Config extends Model
|
|
{
|
|
protected $casts = [
|
|
'data' => 'array',
|
|
];
|
|
|
|
public function data()
|
|
{
|
|
return $this->data[0];
|
|
}
|
|
|
|
public static function getData($configName)
|
|
{
|
|
return Config::where('name',$configName)->first()->data();
|
|
}
|
|
|
|
public function logs()
|
|
{
|
|
return $this->morphMany('App\Log', 'logable');
|
|
}
|
|
|
|
public static function find($name)
|
|
{
|
|
return Config::where('name',$name)->first();
|
|
}
|
|
}
|