-
app/Models/Banking/Account.php
Open in GitHubuse App\Abstracts\Model; class Account extends Model { // protected $casts = [ 'opening_balance' => 'double', 'enabled' => 'boolean', ]; // }
-
app/Traits/Import.php
Open in GitHubuse App\Models\Banking\Account; trait Import { // public function getAccountIdFromCurrency($row) { return Account::firstOrCreate([ 'company_id' => company_id(), 'currency_code' => $row['currency_code'], ], [ 'name' => !empty($row['account_name']) ? $row['account_name'] : $row['currency_code'], 'number' => !empty($row['account_number']) ? $row['account_number'] : rand(1, 10000), 'opening_balance' => !empty($row['opening_balance']) ? $row['opening_balance'] : 0, 'enabled' => 1, ])->id; } // }