2019-09-10 04:30:43 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2020-01-07 01:13:47 +01:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-09-10 04:30:43 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use App\DataMapper\ClientSettings;
|
|
|
|
use App\DataMapper\CompanySettings;
|
2019-09-11 07:32:47 +02:00
|
|
|
use App\Models\Client;
|
2019-09-10 04:30:43 +02:00
|
|
|
use App\Models\Company;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
use Hashids\Hashids;
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2019-09-11 07:32:47 +02:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2019-09-10 04:30:43 +02:00
|
|
|
|
2019-09-12 03:28:41 +02:00
|
|
|
class GroupSetting extends StaticModel
|
2019-09-10 04:30:43 +02:00
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
use MakesHash;
|
2020-02-27 00:32:44 +01:00
|
|
|
use SoftDeletes;
|
2019-12-30 22:59:12 +01:00
|
|
|
|
2020-08-04 10:21:14 +02:00
|
|
|
//public $timestamps = false;
|
2019-09-11 07:32:47 +02:00
|
|
|
|
2019-09-10 04:30:43 +02:00
|
|
|
protected $casts = [
|
2019-09-26 00:27:26 +02:00
|
|
|
'settings' => 'object',
|
|
|
|
'updated_at' => 'timestamp',
|
|
|
|
'created_at' => 'timestamp',
|
|
|
|
'deleted_at' => 'timestamp',
|
2019-09-10 04:30:43 +02:00
|
|
|
];
|
|
|
|
|
2019-10-05 00:58:51 +02:00
|
|
|
protected $fillable = [
|
2019-12-30 22:59:12 +01:00
|
|
|
'name',
|
|
|
|
'settings'
|
2019-10-05 02:11:04 +02:00
|
|
|
];
|
2019-10-05 00:58:51 +02:00
|
|
|
|
2020-07-23 05:55:11 +02:00
|
|
|
protected $touches = [];
|
2020-07-16 13:01:39 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
public function company()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Company::class);
|
|
|
|
}
|
2019-09-10 04:30:43 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
}
|
2019-09-10 04:30:43 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
public function clients()
|
|
|
|
{
|
|
|
|
return $this->hasMany(Client::class, 'id', 'group_settings_id');
|
|
|
|
}
|
2019-09-11 07:32:47 +02:00
|
|
|
|
2019-11-06 23:57:09 +01:00
|
|
|
/**
|
|
|
|
* Retrieve the model for a bound value.
|
|
|
|
*
|
|
|
|
* @param mixed $value
|
|
|
|
* @return \Illuminate\Database\Eloquent\Model|null
|
|
|
|
*/
|
|
|
|
public function resolveRouteBinding($value)
|
|
|
|
{
|
|
|
|
return $this
|
|
|
|
->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
|
|
|
}
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|