2017-09-14 19:21:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models\Setting;
|
|
|
|
|
|
2022-03-02 09:19:46 +00:00
|
|
|
use App\Abstracts\Model;
|
2017-09-14 19:21:00 +00:00
|
|
|
|
2022-03-02 09:19:46 +00:00
|
|
|
class Setting extends Model
|
2017-09-14 19:21:00 +00:00
|
|
|
{
|
|
|
|
|
protected $table = 'settings';
|
|
|
|
|
|
2021-01-19 14:36:39 +00:00
|
|
|
/**
|
|
|
|
|
* Attributes that should be mass-assignable.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $fillable = ['company_id', 'key', 'value'];
|
|
|
|
|
|
2021-03-06 08:44:28 +00:00
|
|
|
/**
|
2022-03-02 09:19:46 +00:00
|
|
|
* Indicates if the model should be timestamped.
|
2021-03-06 08:44:28 +00:00
|
|
|
*
|
2022-03-02 09:19:46 +00:00
|
|
|
* @var bool
|
2021-03-06 08:44:28 +00:00
|
|
|
*/
|
2022-03-02 09:19:46 +00:00
|
|
|
public $timestamps = false;
|
2017-09-14 19:21:00 +00:00
|
|
|
|
|
|
|
|
/**
|
2020-02-09 09:44:36 +00:00
|
|
|
* Scope to only include by prefix.
|
2017-09-14 19:21:00 +00:00
|
|
|
*
|
2020-02-09 09:44:36 +00:00
|
|
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
2020-02-14 12:08:16 +00:00
|
|
|
* @param string $prefix
|
2020-02-09 09:44:36 +00:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Builder
|
2017-09-14 19:21:00 +00:00
|
|
|
*/
|
2020-02-09 09:49:46 +00:00
|
|
|
public function scopePrefix($query, $prefix = 'company')
|
2017-09-14 19:21:00 +00:00
|
|
|
{
|
2020-02-09 09:44:36 +00:00
|
|
|
return $query->where('key', 'like', $prefix . '.%');
|
2017-09-14 19:21:00 +00:00
|
|
|
}
|
|
|
|
|
}
|