added soft delete to settings table
This commit is contained in:
@ -2,13 +2,10 @@
|
||||
|
||||
namespace App\Models\Setting;
|
||||
|
||||
use App\Traits\Tenants;
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
use App\Abstracts\Model;
|
||||
|
||||
class Setting extends Eloquent
|
||||
class Setting extends Model
|
||||
{
|
||||
use Tenants;
|
||||
|
||||
protected $table = 'settings';
|
||||
|
||||
/**
|
||||
@ -18,42 +15,13 @@ class Setting extends Eloquent
|
||||
*/
|
||||
protected $fillable = ['company_id', 'key', 'value'];
|
||||
|
||||
public $allAttributes = [];
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Create a new Eloquent model instance.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
$this->allAttributes = $attributes;
|
||||
|
||||
parent::__construct($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the model in the database.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
public function update(array $attributes = [], array $options = [])
|
||||
{
|
||||
$this->allAttributes = $attributes;
|
||||
|
||||
return parent::update($attributes, $options);
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Common\Company');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope to only include by prefix.
|
||||
*
|
||||
@ -66,17 +34,4 @@ class Setting extends Eloquent
|
||||
{
|
||||
return $query->where('key', 'like', $prefix . '.%');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope to only include company data.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param $company_id
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeCompanyId($query, $company_id)
|
||||
{
|
||||
return $query->where($this->qualifyColumn('company_id'), '=', $company_id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user