Skip to content

Commit 3eb5a8e

Browse files
draft
1 parent f38257b commit 3eb5a8e

File tree

77 files changed

+1672
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1672
-2
lines changed

.blueprint

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
created:
2+
- database/factories/CustomerFactory.php
3+
- database/factories/SupplierFactory.php
4+
- database/factories/CategoryFactory.php
5+
- database/factories/SubCategoryFactory.php
6+
- database/factories/ProductFactory.php
7+
- database/factories/PaymentTypeFactory.php
8+
- database/factories/PurchaseOrderFactory.php
9+
- database/factories/PurchaseOrderItemFactory.php
10+
- database/factories/SaleFactory.php
11+
- database/factories/SaleItemFactory.php
12+
- database/factories/SettingFactory.php
13+
- database/migrations/2024_06_03_165224_create_customers_table.php
14+
- database/migrations/2024_06_03_165225_create_suppliers_table.php
15+
- database/migrations/2024_06_03_165226_create_categories_table.php
16+
- database/migrations/2024_06_03_165227_create_sub_categories_table.php
17+
- database/migrations/2024_06_03_165228_create_products_table.php
18+
- database/migrations/2024_06_03_165229_create_payment_types_table.php
19+
- database/migrations/2024_06_03_165230_create_purchase_orders_table.php
20+
- database/migrations/2024_06_03_165231_create_purchase_order_items_table.php
21+
- database/migrations/2024_06_03_165232_create_sales_table.php
22+
- database/migrations/2024_06_03_165233_create_sale_items_table.php
23+
- database/migrations/2024_06_03_165234_create_settings_table.php
24+
- app/Models/Customer.php
25+
- app/Models/Supplier.php
26+
- app/Models/Category.php
27+
- app/Models/SubCategory.php
28+
- app/Models/Product.php
29+
- app/Models/PaymentType.php
30+
- app/Models/PurchaseOrder.php
31+
- app/Models/PurchaseOrderItem.php
32+
- app/Models/Sale.php
33+
- app/Models/SaleItem.php
34+
- app/Models/Setting.php
35+
models:
36+
Customer: { name: string, email: 'string nullable', phone: 'string nullable', address: text, status: 'enum:active,inactive', gender: 'enum:male,female' }
37+
Supplier: { company_name: string, contact_person: string, email: 'string nullable', phone: 'string nullable', status: 'enum:active,inactive' }
38+
Category: { name: string, description: 'text nullable', status: 'enum:active,inactive', relationships: { hasMany: SubCategory } }
39+
SubCategory: { name: string, description: 'text nullable', status: 'enum:active,inactive', relationships: { belongsTo: Category } }
40+
Product: { sku: 'string unique', name: string, purchase_price: decimal, selling_price: decimal, description: 'text nullable', status: 'enum:active,inactive' }
41+
PaymentType: { name: string, description: 'text nullable' }
42+
PurchaseOrder: { purchase_code: 'string unique', order_date: date, expected_delivery_date: 'date nullable', status: 'enum:pending,received,partially received,cancelled', total_amount: decimal, paid_amount: decimal, relationships: { belongsTo: 'Supplier, PaymentType', hasMany: PurchaseOrderItem } }
43+
PurchaseOrderItem: { sku: string, name: string, quantity: integer, unit_cost: decimal, relationships: { belongsTo: 'PurchaseOrder, Product' } }
44+
Sale: { invoice_number: string, sale_date: date, vat: double, total_amount: decimal, paid_amount: decimal, relationships: { belongsTo: 'Customer, PaymentType', hasMany: SaleItem } }
45+
SaleItem: { sku: string, name: string, quantity: integer, unit_cost: decimal, relationships: { belongsTo: 'Sale, Product' } }
46+
Setting: { company_name: string, phone: string, email: string, address: text, currency: string }

app/Models/Category.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Database\Eloquent\Relations\HasMany;
8+
9+
class Category extends Model
10+
{
11+
use HasFactory;
12+
13+
/**
14+
* The attributes that should be cast to native types.
15+
*
16+
* @var array
17+
*/
18+
protected $casts = [
19+
'id' => 'integer',
20+
];
21+
22+
public function subCategories(): HasMany
23+
{
24+
return $this->hasMany(SubCategory::class);
25+
}
26+
}

app/Models/Customer.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class Customer extends Model
9+
{
10+
use HasFactory;
11+
12+
/**
13+
* The attributes that should be cast to native types.
14+
*
15+
* @var array
16+
*/
17+
protected $casts = [
18+
'id' => 'integer',
19+
];
20+
}

app/Models/PaymentType.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class PaymentType extends Model
9+
{
10+
use HasFactory;
11+
12+
/**
13+
* The attributes that should be cast to native types.
14+
*
15+
* @var array
16+
*/
17+
protected $casts = [
18+
'id' => 'integer',
19+
];
20+
}

app/Models/Product.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class Product extends Model
9+
{
10+
use HasFactory;
11+
12+
/**
13+
* The attributes that should be cast to native types.
14+
*
15+
* @var array
16+
*/
17+
protected $casts = [
18+
'id' => 'integer',
19+
'purchase_price' => 'decimal',
20+
'selling_price' => 'decimal',
21+
];
22+
}

app/Models/PurchaseOrder.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8+
use Illuminate\Database\Eloquent\Relations\HasMany;
9+
10+
class PurchaseOrder extends Model
11+
{
12+
use HasFactory;
13+
14+
/**
15+
* The attributes that should be cast to native types.
16+
*
17+
* @var array
18+
*/
19+
protected $casts = [
20+
'id' => 'integer',
21+
'order_date' => 'date',
22+
'expected_delivery_date' => 'date',
23+
'total_amount' => 'decimal',
24+
'paid_amount' => 'decimal',
25+
'supplier_id' => 'integer',
26+
'payment_type_id' => 'integer',
27+
];
28+
29+
public function supplier(): BelongsTo
30+
{
31+
return $this->belongsTo(Supplier::class);
32+
}
33+
34+
public function paymentType(): BelongsTo
35+
{
36+
return $this->belongsTo(PaymentType::class);
37+
}
38+
39+
public function purchaseOrderItems(): HasMany
40+
{
41+
return $this->hasMany(PurchaseOrderItem::class);
42+
}
43+
}

app/Models/PurchaseOrderItem.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8+
9+
class PurchaseOrderItem extends Model
10+
{
11+
use HasFactory;
12+
13+
/**
14+
* The attributes that should be cast to native types.
15+
*
16+
* @var array
17+
*/
18+
protected $casts = [
19+
'id' => 'integer',
20+
'unit_cost' => 'decimal',
21+
'purchase_order_id' => 'integer',
22+
'product_id' => 'integer',
23+
];
24+
25+
public function purchaseOrder(): BelongsTo
26+
{
27+
return $this->belongsTo(PurchaseOrder::class);
28+
}
29+
30+
public function product(): BelongsTo
31+
{
32+
return $this->belongsTo(Product::class);
33+
}
34+
}

app/Models/Sale.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8+
use Illuminate\Database\Eloquent\Relations\HasMany;
9+
10+
class Sale extends Model
11+
{
12+
use HasFactory;
13+
14+
/**
15+
* The attributes that should be cast to native types.
16+
*
17+
* @var array
18+
*/
19+
protected $casts = [
20+
'id' => 'integer',
21+
'sale_date' => 'date',
22+
'vat' => 'double',
23+
'total_amount' => 'decimal',
24+
'paid_amount' => 'decimal',
25+
'customer_id' => 'integer',
26+
'payment_type_id' => 'integer',
27+
];
28+
29+
public function customer(): BelongsTo
30+
{
31+
return $this->belongsTo(Customer::class);
32+
}
33+
34+
public function paymentType(): BelongsTo
35+
{
36+
return $this->belongsTo(PaymentType::class);
37+
}
38+
39+
public function saleItems(): HasMany
40+
{
41+
return $this->hasMany(SaleItem::class);
42+
}
43+
}

app/Models/SaleItem.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8+
9+
class SaleItem extends Model
10+
{
11+
use HasFactory;
12+
13+
/**
14+
* The attributes that should be cast to native types.
15+
*
16+
* @var array
17+
*/
18+
protected $casts = [
19+
'id' => 'integer',
20+
'unit_cost' => 'decimal',
21+
'sale_id' => 'integer',
22+
'product_id' => 'integer',
23+
];
24+
25+
public function sale(): BelongsTo
26+
{
27+
return $this->belongsTo(Sale::class);
28+
}
29+
30+
public function product(): BelongsTo
31+
{
32+
return $this->belongsTo(Product::class);
33+
}
34+
}

app/Models/Setting.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class Setting extends Model
9+
{
10+
use HasFactory;
11+
12+
/**
13+
* The attributes that should be cast to native types.
14+
*
15+
* @var array
16+
*/
17+
protected $casts = [
18+
'id' => 'integer',
19+
];
20+
}

0 commit comments

Comments
 (0)