akaunting/app/Models/Setting/Setting.php

38 lines
753 B
PHP
Raw Normal View History

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