Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

akaunting/akaunting

9348 stars
2 code files
View akaunting/akaunting on GitHub

database/factories/Account.php

Open in GitHub
use App\Abstracts\Factory;
use App\Models\Banking\Account as Model;
 
class Account extends Factory
{
protected $model = Model::class;
 
public function definition()
{
return [
'company_id' => $this->company->id,
'name' => $this->faker->text(15),
'number' => (string) $this->faker->iban(),
'currency_code' => $this->company->currencies()->enabled()->get()->random(1)->pluck('code')->first(),
'opening_balance' => '0',
'bank_name' => $this->faker->text(15),
'bank_phone' => $this->faker->phoneNumber,
'bank_address' => $this->faker->address,
'enabled' => $this->faker->boolean ? 1 : 0,
];
}
 
public function enabled()
{
return $this->state([
'enabled' => 1,
]);
}
}

database/seeds/SampleData.php

Open in GitHub
use App\Models\Banking\Account;
use Illuminate\Database\Seeder;
 
class SampleData extends Seeder
{
public function run()
{
Model::reguard();
 
$this->command->info('Creating sample data...');
 
$bar = $this->command->getOutput()->createProgressBar(7);
$bar->setFormat('verbose');
 
$bar->start();
 
$count = (int) $this->command->option('count');
$small_count = ($count <= 10) ? $count : 10;
 
Account::factory()->count($small_count)->create();
$bar->advance();
 
$this->command->info('');
$this->command->info('Sample data created.');
 
Model::unguard();
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.