1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Models/BaseModel.php
David Bomba eddb9adc73
Client Settings (#2668)
* Clean up Client Show

* Working on Show Client menu action

* working on client view permissions

* Finishing up Client Statement View

* Workig on client settings

* add mix manifest

* css for client settings

* Client Settings

* Working on Client Settings

* Implement StartupCheck and static seeders

* Implement cached statics in view composers

* Working on client settings

* Payment Terms

* Working on Payment Terms View Composer

* Payment Terms builder

* Client Settings

* refactor companies table

* Refactor for company settings, move settings to json

* Set object cast on settings column of Company table

* Fixes for refactor of companies and clients table

* Test

* Client Settings Datamapper

* Client Settings

* Default client language

* Client Settings

* Working on client settings options

* Client Settings

* Settings Json serialization/deserialization handling
2019-02-17 21:34:46 +11:00

39 lines
851 B
PHP

<?php
namespace App\Models;
use App\Filters\QueryFilters;
use App\Utils\Traits\UserSessionAttributes;
use Hashids\Hashids;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
use UserSessionAttributes;
public function __call($method, $params)
{
$entity = strtolower(class_basename($this));
if ($entity) {
$configPath = "modules.relations.$entity.$method";
if (config()->has($configPath)) {
$function = config()->get($configPath);
return call_user_func_array(array($this, $function[0]), $function[1]);
}
}
return parent::__call($method, $params);
}
public function scopeScope($query)
{
$query->where($this->getTable() .'.company_id', '=', $this->getCurrentCompanyId());
return $query;
}
}