mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 19:47:34 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			72 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 * Invoice Ninja (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
						|
 *
 | 
						|
 * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @license https://opensource.org/licenses/AAL
 | 
						|
 */
 | 
						|
 | 
						|
namespace App\Models;
 | 
						|
 | 
						|
use App\DataMapper\ClientSettings;
 | 
						|
use App\DataMapper\CompanySettings;
 | 
						|
use App\Models\Client;
 | 
						|
use App\Models\Company;
 | 
						|
use App\Models\User;
 | 
						|
use App\Utils\Traits\MakesHash;
 | 
						|
use Hashids\Hashids;
 | 
						|
use Illuminate\Database\Eloquent\SoftDeletes;
 | 
						|
use Illuminate\Database\Eloquent\Model;
 | 
						|
 | 
						|
class GroupSetting extends StaticModel
 | 
						|
{
 | 
						|
    use MakesHash;
 | 
						|
    use SoftDeletes;
 | 
						|
    
 | 
						|
    public $timestamps = false;
 | 
						|
 | 
						|
    protected $casts = [
 | 
						|
        'settings' => 'object',
 | 
						|
        'updated_at' => 'timestamp',
 | 
						|
        'created_at' => 'timestamp',
 | 
						|
        'deleted_at' => 'timestamp',
 | 
						|
    ];
 | 
						|
 | 
						|
    protected $fillable = [
 | 
						|
        'name',
 | 
						|
        'settings'
 | 
						|
    ];
 | 
						|
 | 
						|
    protected $touches = [];
 | 
						|
 | 
						|
    public function company()
 | 
						|
    {
 | 
						|
        return $this->belongsTo(Company::class);
 | 
						|
    }
 | 
						|
 | 
						|
    public function user()
 | 
						|
    {
 | 
						|
        return $this->belongsTo(User::class);
 | 
						|
    }
 | 
						|
 | 
						|
    public function clients()
 | 
						|
    {
 | 
						|
        return $this->hasMany(Client::class, 'id', 'group_settings_id');
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * 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();
 | 
						|
    }
 | 
						|
}
 |