提交代码
This commit is contained in:
27
app/Models/Config.php
Normal file
27
app/Models/Config.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Config extends Model
|
||||
{
|
||||
protected $table = 'admin_config';
|
||||
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'name';
|
||||
}
|
||||
|
||||
protected function setValueAttribute($value)
|
||||
{
|
||||
switch (strtolower($value)) {
|
||||
case 'on':
|
||||
$value = 1;
|
||||
break;
|
||||
case 'off':
|
||||
$value = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
$this->attributes['value'] = $value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user