diff --git a/app/Abstracts/Model.php b/app/Abstracts/Model.php index b6dc5f8c1..fe9b12678 100644 --- a/app/Abstracts/Model.php +++ b/app/Abstracts/Model.php @@ -21,6 +21,23 @@ abstract class Model extends Eloquent 'enabled' => 'boolean', ]; + public $allAttributes = [ + // + ]; + + /** + * Create a new Eloquent model instance. + * + * @param array $attributes + * @return void + */ + public function __construct(array $attributes = []) + { + $this->allAttributes = $attributes; + + parent::__construct($attributes); + } + public static function observe($classes) { parent::observe($classes); diff --git a/app/Imports/Banking/Transfers.php b/app/Imports/Banking/Transfers.php index fcf796c72..4a6b13b9f 100644 --- a/app/Imports/Banking/Transfers.php +++ b/app/Imports/Banking/Transfers.php @@ -49,19 +49,19 @@ class Transfers extends Import private function getExpenseTransactionId($row) { $expense_transaction = Transaction::create([ - 'company_id' => session('company_id'), - 'type' => 'expense', - 'account_id' => $row['from_account_id'], - 'paid_at' => $row['transferred_at'], - 'currency_code' => $row['from_currency_code'], - 'currency_rate' => $row['from_currency_rate'], - 'amount' => $row['amount'], - 'contact_id' => 0, - 'description' => $row['description'], - 'category_id' => Category::transfer(), // Transfer Category ID - 'payment_method' => $row['payment_method'], - 'reference' => $row['reference'], - ]); + 'company_id' => session('company_id'), + 'type' => 'expense', + 'account_id' => $row['from_account_id'], + 'paid_at' => $row['transferred_at'], + 'currency_code' => $row['from_currency_code'], + 'currency_rate' => $row['from_currency_rate'], + 'amount' => $row['amount'], + 'contact_id' => 0, + 'description' => $row['description'], + 'category_id' => Category::transfer(), // Transfer Category ID + 'payment_method' => $row['payment_method'], + 'reference' => $row['reference'], + ]); return $expense_transaction->id; } @@ -81,19 +81,19 @@ class Transfers extends Import } $income_transaction = Transaction::create([ - 'company_id' => session('company_id'), - 'type' => 'income', - 'account_id' => $row['to_account_id'], - 'paid_at' => $row['transferred_at'], - 'currency_code' => $row['to_currency_code'], - 'currency_rate' => $row['to_currency_rate'], - 'amount' => $amount, - 'contact_id' => 0, - 'description' => $row['description'], - 'category_id' => Category::transfer(), // Transfer Category ID - 'payment_method' => $row['payment_method'], - 'reference' => $row['reference'], - ]); + 'company_id' => session('company_id'), + 'type' => 'income', + 'account_id' => $row['to_account_id'], + 'paid_at' => $row['transferred_at'], + 'currency_code' => $row['to_currency_code'], + 'currency_rate' => $row['to_currency_rate'], + 'amount' => $amount, + 'contact_id' => 0, + 'description' => $row['description'], + 'category_id' => Category::transfer(), // Transfer Category ID + 'payment_method' => $row['payment_method'], + 'reference' => $row['reference'], + ]); return $income_transaction->id; } diff --git a/app/Imports/Purchases/Payments.php b/app/Imports/Purchases/Payments.php index e5b9a9dde..f35932ffd 100644 --- a/app/Imports/Purchases/Payments.php +++ b/app/Imports/Purchases/Payments.php @@ -3,8 +3,8 @@ namespace App\Imports\Purchases; use App\Abstracts\Import; -use App\Models\Banking\Transaction as Model; use App\Http\Requests\Banking\Transaction as Request; +use App\Models\Banking\Transaction as Model; class Payments extends Import { diff --git a/app/Imports/Purchases/Vendors.php b/app/Imports/Purchases/Vendors.php index 2e9889714..93a8130a6 100644 --- a/app/Imports/Purchases/Vendors.php +++ b/app/Imports/Purchases/Vendors.php @@ -3,8 +3,8 @@ namespace App\Imports\Purchases; use App\Abstracts\Import; -use App\Models\Common\Contact as Model; use App\Http\Requests\Common\Contact as Request; +use App\Models\Common\Contact as Model; class Vendors extends Import { diff --git a/app/Imports/Sales/Customers.php b/app/Imports/Sales/Customers.php index a744bc64c..52140ca4c 100644 --- a/app/Imports/Sales/Customers.php +++ b/app/Imports/Sales/Customers.php @@ -3,8 +3,8 @@ namespace App\Imports\Sales; use App\Abstracts\Import; -use App\Models\Common\Contact as Model; use App\Http\Requests\Common\Contact as Request; +use App\Models\Common\Contact as Model; class Customers extends Import { diff --git a/app/Models/Common/Company.php b/app/Models/Common/Company.php index 210fc8772..1224d24a2 100644 --- a/app/Models/Common/Company.php +++ b/app/Models/Common/Company.php @@ -28,6 +28,10 @@ class Company extends Eloquent 'enabled' => 'boolean', ]; + public $allAttributes = [ + // + ]; + /** * Sortable columns. * @@ -35,6 +39,19 @@ class Company extends Eloquent */ public $sortable = ['name', 'domain', 'email', 'enabled', 'created_at']; + /** + * Create a new Eloquent model instance. + * + * @param array $attributes + * @return void + */ + public function __construct(array $attributes = []) + { + $this->allAttributes = $attributes; + + parent::__construct($attributes); + } + public static function boot() { parent::boot(); diff --git a/app/Models/Setting/Setting.php b/app/Models/Setting/Setting.php index c12ce0191..b908a93c9 100644 --- a/app/Models/Setting/Setting.php +++ b/app/Models/Setting/Setting.php @@ -13,8 +13,6 @@ class Setting extends Eloquent protected $tenantable = true; - public $timestamps = false; - /** * Attributes that should be mass-assignable. * @@ -22,6 +20,25 @@ class Setting extends Eloquent */ protected $fillable = ['company_id', 'key', 'value']; + public $allAttributes = [ + // + ]; + + 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); + } + public function company() { return $this->belongsTo('App\Models\Common\Company');