Skip to content

Commit

Permalink
📝 Add seed
Browse files Browse the repository at this point in the history
  • Loading branch information
saleem-hadad committed Jan 14, 2022
1 parent 73a893d commit 2cfaf27
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 1 deletion.
92 changes: 92 additions & 0 deletions database/seeders/CategoryBrandSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php

namespace Database\Seeders;

use App\Models\Category;
use Illuminate\Database\Seeder;

class CategoryBrandSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Category::create(['name' => 'Salary', 'type' => Category::INCOME])
->brands()
->create(['name' => 'Salary']);

Category::create(['name' => 'Housing', 'type' => Category::EXPENSES])
->brands()
->create(['name' => 'Housing']);

Category::create(['name' => 'Groceries', 'type' => Category::EXPENSES])
->brands()
->createMany([
['name' => 'LULU'],
['name' => 'ASWAAQ'],
['name' => 'TUDO'],
['name' => 'CARREFOUR'],
]);

Category::create(['name' => 'Utilities', 'type' => Category::EXPENSES])
->brands()
->createMany([
['name' => 'ETISALAT'],
['name' => 'Smart Dubai'],
]);

Category::create(['name' => 'Transportation', 'type' => Category::EXPENSES])
->brands()
->createMany([
['name' => 'EMARAT'],
['name' => 'Careem'],
['name' => 'ENOC'],
]);

Category::create(['name' => 'Shopping', 'type' => Category::EXPENSES])
->brands()
->createMany([
['name' => 'CHOCOLALA'],
['name' => 'IKEA'],
['name' => 'HOME CENTRE'],
['name' => 'MCDONALDS'],
['name' => 'SUBWAY'],
]);

Category::create(['name' => 'Internet Subscription', 'type' => Category::EXPENSES])
->brands()
->createMany([
['name' => 'FACEBK'],
['name' => 'Google'],
]);

Category::create(['name' => 'Family Support', 'type' => Category::EXPENSES])
->brands()
->createMany([
['name' => 'Family Support'],
]);

Category::create(['name' => 'Debt', 'type' => Category::EXPENSES])
->brands()
->createMany([
['name' => 'Debt'],
]);

Category::create(['name' => 'Medicine', 'type' => Category::EXPENSES])
->brands()
->createMany([
['name' => 'MEDICINA'],
['name' => 'LIFE PHY'],
['name' => 'IBN SINA'],
]);

Category::create(['name' => 'Others', 'type' => Category::EXPENSES])
->brands()
->createMany([
['name' => 'Others'],
]);
}
}
4 changes: 3 additions & 1 deletion database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// \App\Models\User::factory(10)->create();
$this->call([
CategoryBrandSeeder::class,
]);
}
}

0 comments on commit 2cfaf27

Please sign in to comment.