Skip to content

Commit

Permalink
Dust
Browse files Browse the repository at this point in the history
  • Loading branch information
techenby committed May 14, 2023
1 parent 02d5701 commit 17058ad
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 36 deletions.
10 changes: 5 additions & 5 deletions app/Filament/Resources/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function table(Table $table): Table
->action(function (Product $record) {
$record->addToQueue();
Notification::make()
->title('Added Product to Queue')
->title('Added Product to Queue')
->success()
->send();
}),
Expand All @@ -58,20 +58,20 @@ public static function table(Table $table): Table
DeleteBulkAction::make(),
]);
}

public static function getRelations(): array
{
return [
TemplatesRelationManager::class
TemplatesRelationManager::class,
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListProducts::route('/'),
'create' => Pages\CreateProduct::route('/create'),
'edit' => Pages\EditProduct::route('/{record}/edit'),
];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources\ProductResource\Pages;

use App\Filament\Resources\ProductResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateProduct extends CreateRecord
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
namespace App\Filament\Resources\ProductResource\RelationManagers;

use App\Filament\Resources\JobResource;
use App\Models\Template;
use Filament\Resources\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Resources\Table;
use Filament\Tables;
use Filament\Tables\Actions\CreateAction;
use Filament\Tables\Actions\DeleteAction;
use Filament\Tables\Actions\DeleteBulkAction;
Expand Down Expand Up @@ -64,6 +62,7 @@ public static function table(Table $table): Table
'user_id' => auth()->id(),
]));
}

return $model;
}),
])
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function templates()
public function addToQueue()
{
$this->templates->each(function ($template) {
$data = Arr::only($template->toArray(), ["team_id", "print_type_id", "name", "color_hex", "files", "notes"]);
$data = Arr::only($template->toArray(), ['team_id', 'print_type_id', 'name', 'color_hex', 'files', 'notes']);
Job::create(array_merge(['user_id' => auth()->id(), 'type' => Job::class], $data));
});
}
Expand Down
8 changes: 0 additions & 8 deletions app/Models/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

namespace App\Models;

use App\Jobs\FetchPrinterStatus;
use App\Jobs\ProcessJobFiles;
use App\Traits\HasTeam;
use Exception;
use Facades\App\Calculator;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Facades\Http;
use Parental\HasParent;

class Template extends Job
Expand Down
2 changes: 1 addition & 1 deletion database/factories/ProductFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ProductFactory extends Factory
public function definition(): array
{
return [
'name' => 'Dice Tray'
'name' => 'Dice Tray',
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('products', function (Blueprint $table) {
Expand All @@ -18,9 +15,6 @@ public function up(): void
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('products');
Expand Down
6 changes: 0 additions & 6 deletions database/migrations/2023_05_14_002335_add_type_to_jobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('jobs', function (Blueprint $table) {
$table->string('type')->nullable()->after('id');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('jobs', function (Blueprint $table) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('product_template', function (Blueprint $table) {
Expand All @@ -20,9 +17,6 @@ public function up(): void
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('product_template');
Expand Down

0 comments on commit 17058ad

Please sign in to comment.