%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : addictionfreeind ( 1003)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/addictionfreeind/public_html/admin1/database/seeders/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/addictionfreeind/public_html/admin1/database/seeders/BankAccountSeeder.php
<?php

namespace Database\Seeders;

use App\Models\BankAccount;
use App\Models\BankTransaction;
use App\Models\Currency;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class BankAccountSeeder extends Seeder
{

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run($companyId)
    {
        $currencyId = Currency::where('company_id', $companyId)->first()->id;;

        DB::beginTransaction();

        $bankAccounts = ['Primary Account', 'Secondary Account'];

        foreach ($bankAccounts as $key => $bankAccount) {
            $account = new BankAccount();
            $account->company_id    = $companyId;
            $account->type    = 'bank';
            $account->account_name    = fake()->company();
            $account->account_type  = 'current';
            $account->currency_id     = $currencyId;
            $account->contact_number  = fake()->phoneNumber();
            $account->opening_balance = fake()->numberBetween(10000, 99999);
            $account->status          = 1;
            $account->bank_name    = $bankAccount;
            /** @phpstan-ignore-next-line */
            $account->account_number  = fake()->bankAccountNumber();
            $account->save();
        }

        DB::commit();

    }

}

VaKeR 2022