Replace icons with lucide and work on quote
This commit is contained in:
parent
b3868e8b0a
commit
913a4477a7
@ -20,22 +20,16 @@ public function getLabel(): ?string
|
|||||||
return $this->value;
|
return $this->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function getColor(): string|array|null
|
|
||||||
// {
|
|
||||||
// return match ($this) {
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function getIcon(): ?string
|
public function getIcon(): ?string
|
||||||
{
|
{
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
self::new_art => 'heroicon-o-paint-brush',
|
self::new_art => 'lucide-brush',
|
||||||
self::repeat => 'heroicon-o-clipboard-document',
|
self::repeat => 'lucide-files',
|
||||||
self::rush => 'heroicon-o-clock',
|
self::rush => 'lucide-bell-ring',
|
||||||
self::event => 'heroicon-o-users',
|
self::event => 'lucide-calendar-range',
|
||||||
self::digitizing => 'heroicon-o-computer-desktop',
|
self::digitizing => 'lucide-computer',
|
||||||
self::garments => 'heroicon-o-shopping-bag',
|
self::garments => 'lucide-shirt',
|
||||||
self::supplied_file => 'heroicon-o-arrow-down-tray',
|
self::supplied_file => 'lucide-file-check',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ public function getColor(): string|array|null
|
|||||||
public function getIcon(): ?string
|
public function getIcon(): ?string
|
||||||
{
|
{
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
self::DRAFT => 'heroicon-o-pencil',
|
self::DRAFT => 'lucide-pencil',
|
||||||
self::APPROVED => 'heroicon-o-check',
|
self::APPROVED => 'lucide-check-check',
|
||||||
self::PRODUCTION => 'heroicon-o-arrow-path',
|
self::PRODUCTION => 'lucide-iteration-ccw',
|
||||||
self::SHIPPED => 'heroicon-o-paper-airplane',
|
self::SHIPPED => 'lucide-send',
|
||||||
self::INVOICED => 'heroicon-o-credit-card',
|
self::INVOICED => 'lucide-credit-card',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,9 @@ class InvoiceResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = Invoice::class;
|
protected static ?string $model = Invoice::class;
|
||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-clipboard-document-list';
|
protected static ?string $navigationIcon = 'lucide-receipt-text';
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Billing';
|
protected static ?string $navigationGroup = 'Production';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 2;
|
protected static ?int $navigationSort = 2;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class OrderResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = Order::class;
|
protected static ?string $model = Order::class;
|
||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-shopping-bag';
|
protected static ?string $navigationIcon = 'lucide-shopping-cart';
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Production';
|
protected static ?string $navigationGroup = 'Production';
|
||||||
|
|
||||||
@ -55,7 +55,10 @@ public static function form(Form $form): Form
|
|||||||
|
|
||||||
Select::make('contact_id')
|
Select::make('contact_id')
|
||||||
->label('Contact')
|
->label('Contact')
|
||||||
->options(fn ($get): array => Contact::where('customer_id', $get('customer_id') ?? null)->get()->pluck('full_name', 'id')->toArray())
|
->options(fn ($get): array => Contact::where('customer_id', $get('customer_id') ?? null)
|
||||||
|
->get()
|
||||||
|
->pluck('full_name', 'id')
|
||||||
|
->toArray())
|
||||||
->searchable(),
|
->searchable(),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
@ -143,12 +143,16 @@ public function handleRecordUpdate(Model $record, array $data): Model
|
|||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
Action::make('save')
|
||||||
|
->label('Save changes')
|
||||||
|
->action('save')
|
||||||
|
->icon('lucide-save'),
|
||||||
Action::make('print')
|
Action::make('print')
|
||||||
->icon('heroicon-s-printer')
|
->icon('lucide-printer')
|
||||||
->url(fn (Order $record) => route('orders.pdf', $record))
|
->url(fn (Order $record) => route('orders.pdf', $record))
|
||||||
->openUrlInNewTab(),
|
->openUrlInNewTab(),
|
||||||
Actions\DeleteAction::make()
|
Actions\DeleteAction::make()
|
||||||
->icon('heroicon-s-trash'),
|
->icon('lucide-trash-2'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@ class PackingSlipResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = PackingSlip::class;
|
protected static ?string $model = PackingSlip::class;
|
||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
protected static ?string $navigationIcon = 'lucide-package';
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Production';
|
protected static ?string $navigationGroup = 'Management';
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,12 @@
|
|||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\QuoteResource\Pages;
|
use App\Filament\Resources\QuoteResource\Pages;
|
||||||
|
use App\Models\Customer;
|
||||||
|
use App\Models\Order;
|
||||||
use App\Models\Quote;
|
use App\Models\Quote;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\Split;
|
||||||
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
@ -13,9 +18,9 @@ class QuoteResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = Quote::class;
|
protected static ?string $model = Quote::class;
|
||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-chat-bubble-bottom-center-text';
|
protected static ?string $navigationIcon = 'lucide-quote';
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Billing';
|
protected static ?string $navigationGroup = 'Production';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 1;
|
protected static ?int $navigationSort = 1;
|
||||||
|
|
||||||
@ -23,15 +28,36 @@ public static function form(Form $form): Form
|
|||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
->schema([
|
->schema([
|
||||||
//
|
Split::make([
|
||||||
]);
|
Select::make('customer_id')
|
||||||
|
->required()
|
||||||
|
->label('Customer')
|
||||||
|
->options(Customer::all()->pluck('company_name', 'id'))
|
||||||
|
->reactive()
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
Select::make('order_id')
|
||||||
|
->label('Order')
|
||||||
|
->options(fn ($get): array => Order::where('customer_id', $get('customer_id') ?? null)
|
||||||
|
->get()
|
||||||
|
->pluck('customer_po', 'id')
|
||||||
|
->toArray())
|
||||||
|
->searchable(),
|
||||||
|
])->columnSpan(2),
|
||||||
|
Textarea::make('body')
|
||||||
|
->columnSpan(2)
|
||||||
|
->rows(8),
|
||||||
|
])->columns(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->columns([
|
->columns([
|
||||||
//
|
Tables\Columns\TextColumn::make('order.customer.company_name'),
|
||||||
|
Tables\Columns\TextColumn::make('order.customer_po'),
|
||||||
|
Tables\Columns\TextColumn::make('body')
|
||||||
|
->limit(100),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
//
|
//
|
||||||
|
@ -14,14 +14,20 @@ class OrderStats extends BaseWidget
|
|||||||
protected function getStats(): array
|
protected function getStats(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
Stat::make('This Month', $this->getOrdersPast30Days())
|
||||||
|
->icon('heroicon-s-calendar')
|
||||||
|
->chartColor('success')
|
||||||
|
->chart($this->getOrdersInPast30DaysChart())
|
||||||
|
->description('New orders in the past 30 days'),
|
||||||
|
|
||||||
Stat::make('Active Orders', $this->getActiveOrders())
|
Stat::make('Active Orders', $this->getActiveOrders())
|
||||||
->icon('heroicon-o-arrow-path')
|
->icon('heroicon-o-arrow-path')
|
||||||
->description('Orders that have yet to be completed'),
|
->description('Orders that have yet to be completed'),
|
||||||
Stat::make('This Month', $this->getOrdersCurrentMonth())
|
|
||||||
->icon('heroicon-s-calendar')
|
|
||||||
->description('New orders since the beginning of the month'),
|
|
||||||
Stat::make('Due Today', $this->getDueOrders())
|
Stat::make('Due Today', $this->getDueOrders())
|
||||||
->icon('heroicon-o-clock')
|
->icon('heroicon-o-clock')
|
||||||
|
->chartColor('info')
|
||||||
|
->chart($this->getDueOrdersChart())
|
||||||
->description('Orders that are scheduled to be due today'),
|
->description('Orders that are scheduled to be due today'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -34,7 +40,7 @@ private function getActiveOrders(): string
|
|||||||
->count();
|
->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getOrdersCurrentMonth(): string
|
private function getOrdersPast30Days(): string
|
||||||
{
|
{
|
||||||
return Order::all()
|
return Order::all()
|
||||||
->where('order_status', '!=', OrderStatus::SHIPPED)
|
->where('order_status', '!=', OrderStatus::SHIPPED)
|
||||||
@ -43,6 +49,19 @@ private function getOrdersCurrentMonth(): string
|
|||||||
->count();
|
->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getOrdersInPast30DaysChart(): array
|
||||||
|
{
|
||||||
|
$chart = [];
|
||||||
|
$points = 30;
|
||||||
|
$startDate = today()->subDays(31);
|
||||||
|
|
||||||
|
for ($i = 0; $i < $points; $i++) {
|
||||||
|
$chart[$i] = Order::where('order_date', $startDate->addDay())->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $chart;
|
||||||
|
}
|
||||||
|
|
||||||
private function getDueOrders(): string
|
private function getDueOrders(): string
|
||||||
{
|
{
|
||||||
return Order::all()
|
return Order::all()
|
||||||
@ -51,4 +70,17 @@ private function getDueOrders(): string
|
|||||||
->where('due_date', '<=', now())
|
->where('due_date', '<=', now())
|
||||||
->count();
|
->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getDueOrdersChart(): array
|
||||||
|
{
|
||||||
|
$chart = [];
|
||||||
|
$points = 30;
|
||||||
|
$startDate = today()->subDays(31);
|
||||||
|
|
||||||
|
for ($i = 0; $i < $points; $i++) {
|
||||||
|
$chart[$i] = Order::where('due_date', $startDate->addDay())->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $chart;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Spatie\Browsershot\Browsershot;
|
use Spatie\Browsershot\Browsershot;
|
||||||
@ -192,6 +193,11 @@ public function packingSlips(): HasMany
|
|||||||
return $this->hasMany(PackingSlip::class);
|
return $this->hasMany(PackingSlip::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function quote(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(Quote::class);
|
||||||
|
}
|
||||||
|
|
||||||
protected function serializeDate(DateTimeInterface $date): string
|
protected function serializeDate(DateTimeInterface $date): string
|
||||||
{
|
{
|
||||||
return $date->format('Y-m-d');
|
return $date->format('Y-m-d');
|
||||||
|
@ -4,8 +4,19 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
class Quote extends Model
|
class Quote extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'body',
|
||||||
|
'order_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function order(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Order::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"laravel/framework": "^11.9",
|
"laravel/framework": "^11.9",
|
||||||
"laravel/tinker": "^2.9",
|
"laravel/tinker": "^2.9",
|
||||||
"livewire/livewire": "^3.5",
|
"livewire/livewire": "^3.5",
|
||||||
|
"mallardduck/blade-lucide-icons": "^1.23",
|
||||||
"spatie/laravel-pdf": "^1.5"
|
"spatie/laravel-pdf": "^1.5"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
66
composer.lock
generated
66
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "86c43bbee5882b7329eaa389aa089339",
|
"content-hash": "ba64e848b8657779cbac9c8911ad1479",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "anourvalar/eloquent-serialize",
|
"name": "anourvalar/eloquent-serialize",
|
||||||
@ -3349,6 +3349,66 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-08-19T11:52:18+00:00"
|
"time": "2024-08-19T11:52:18+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "mallardduck/blade-lucide-icons",
|
||||||
|
"version": "1.23.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/mallardduck/blade-lucide-icons.git",
|
||||||
|
"reference": "19081819bb527e15eed22f6528b9d059c1a8df8b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/mallardduck/blade-lucide-icons/zipball/19081819bb527e15eed22f6528b9d059c1a8df8b",
|
||||||
|
"reference": "19081819bb527e15eed22f6528b9d059c1a8df8b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"blade-ui-kit/blade-icons": "^1.6",
|
||||||
|
"php": "^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-fileinfo": "*",
|
||||||
|
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
|
||||||
|
"phpunit/phpunit": "^9.0|^10.5|^11.0",
|
||||||
|
"spatie/phpunit-snapshot-assertions": "^4.2.14"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"MallardDuck\\LucideIcons\\BladeLucideIconsServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"MallardDuck\\LucideIcons\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Dan Pock"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A package to easily make use of Lucide icons in your Laravel Blade views.",
|
||||||
|
"homepage": "https://github.com/mallardduck/blade-lucide-icons",
|
||||||
|
"keywords": [
|
||||||
|
"LucideIcons",
|
||||||
|
"blade",
|
||||||
|
"laravel"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/mallardduck/blade-lucide-icons/issues",
|
||||||
|
"source": "https://github.com/mallardduck/blade-lucide-icons/tree/1.23.0"
|
||||||
|
},
|
||||||
|
"time": "2024-07-22T15:40:39+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "masterminds/html5",
|
"name": "masterminds/html5",
|
||||||
"version": "2.9.0",
|
"version": "2.9.0",
|
||||||
@ -10338,12 +10398,12 @@
|
|||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": {},
|
"stability-flags": [],
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "^8.2"
|
"php": "^8.2"
|
||||||
},
|
},
|
||||||
"platform-dev": {},
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,12 @@ class OrderFactory extends Factory
|
|||||||
|
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
$order_date = Carbon::today()->subDays(rand(0, 30));
|
$order_date = Carbon::today()->subDays(rand(0, 60));
|
||||||
$due_date = $order_date->copy()->addDays(rand(9, 15));
|
$due_date = $order_date->copy()->addDays(rand(7, 12));
|
||||||
|
|
||||||
|
$status = $due_date < today() ?
|
||||||
|
OrderStatus::INVOICED->value :
|
||||||
|
$this->faker->randomElement(OrderStatus::cases())->value;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'created_at' => $order_date,
|
'created_at' => $order_date,
|
||||||
@ -24,7 +28,7 @@ public function definition(): array
|
|||||||
'order_type' => $this->faker->randomElement(OrderType::cases())->value,
|
'order_type' => $this->faker->randomElement(OrderType::cases())->value,
|
||||||
'order_date' => $order_date,
|
'order_date' => $order_date,
|
||||||
'due_date' => $due_date,
|
'due_date' => $due_date,
|
||||||
'status' => $this->faker->randomElement(OrderStatus::cases())->value,
|
'status' => $status,
|
||||||
'notes' => $this->faker->words(10, true),
|
'notes' => $this->faker->words(10, true),
|
||||||
|
|
||||||
'rush' => $this->faker->boolean(20),
|
'rush' => $this->faker->boolean(20),
|
||||||
|
21
database/factories/QuoteFactory.php
Normal file
21
database/factories/QuoteFactory.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\Quote;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
|
class QuoteFactory extends Factory
|
||||||
|
{
|
||||||
|
protected $model = Quote::class;
|
||||||
|
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'body' => $this->faker->realText(300),
|
||||||
|
'created_at' => Carbon::now(),
|
||||||
|
'updated_at' => Carbon::now(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,11 @@ public function up(): void
|
|||||||
{
|
{
|
||||||
Schema::create('quotes', function (Blueprint $table) {
|
Schema::create('quotes', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
|
||||||
|
$table->foreignId('order_id')->nullable()->constrained();
|
||||||
|
|
||||||
|
$table->longText('body')->nullable();
|
||||||
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ public function run(): void
|
|||||||
ProductSizeSeeder::class,
|
ProductSizeSeeder::class,
|
||||||
ProductServiceSeeder::class,
|
ProductServiceSeeder::class,
|
||||||
ServiceFileSeeder::class,
|
ServiceFileSeeder::class,
|
||||||
|
QuoteSeeder::class,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
User::factory()->create([
|
User::factory()->create([
|
||||||
|
@ -14,7 +14,7 @@ class OrderSeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
foreach (Customer::all() as $customer) {
|
foreach (Customer::all() as $customer) {
|
||||||
Order::factory(rand(2, 10), ['customer_id' => $customer])->create();
|
Order::factory(rand(2, 50), ['customer_id' => $customer])->create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
database/seeders/QuoteSeeder.php
Normal file
22
database/seeders/QuoteSeeder.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\Quote;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class QuoteSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
foreach (Order::all() as $order) {
|
||||||
|
if (rand(0, 3) >= 1) {
|
||||||
|
Quote::factory()->for($order)->create();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user