refactor: update WarehouseResource to use 'name' as record title and remove unused fields from the warehouse migration
This commit is contained in:
parent
8ddbe5ed29
commit
15de085f58
@ -13,7 +13,6 @@
|
|||||||
use App\Models\Warehouse;
|
use App\Models\Warehouse;
|
||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Forms\Components\Textarea;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
@ -38,7 +37,7 @@ class WarehouseResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 2;
|
protected static ?int $navigationSort = 2;
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'notes';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
protected static ?string $slug = 'master/warehouses';
|
protected static ?string $slug = 'master/warehouses';
|
||||||
|
|
||||||
@ -52,18 +51,6 @@ public static function form(Schema $schema): Schema
|
|||||||
->autocomplete(false)
|
->autocomplete(false)
|
||||||
->required()
|
->required()
|
||||||
->maxLength(30),
|
->maxLength(30),
|
||||||
|
|
||||||
TextInput::make('location')
|
|
||||||
->label('Lokasi')
|
|
||||||
->placeholder('Tasikmalaya')
|
|
||||||
->autocomplete(false)
|
|
||||||
->nullable(),
|
|
||||||
|
|
||||||
Textarea::make('notes')
|
|
||||||
->label('Catatan')
|
|
||||||
->placeholder('...')
|
|
||||||
->nullable()
|
|
||||||
->autocomplete(false),
|
|
||||||
])
|
])
|
||||||
->columns(1);
|
->columns(1);
|
||||||
}
|
}
|
||||||
@ -77,16 +64,6 @@ public static function table(Table $table): Table
|
|||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
TextColumn::make('location')
|
|
||||||
->label('Lokasi')
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
|
|
||||||
TextColumn::make('notes')
|
|
||||||
->label('Catatan')
|
|
||||||
->searchable()
|
|
||||||
->limit(50),
|
|
||||||
|
|
||||||
...TimestampColumns::make(),
|
...TimestampColumns::make(),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
|
|||||||
@ -11,8 +11,6 @@ public function up(): void
|
|||||||
Schema::create('warehouses', function (Blueprint $table) {
|
Schema::create('warehouses', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name', 30);
|
$table->string('name', 30);
|
||||||
$table->string('location')->nullable();
|
|
||||||
$table->text('notes')->nullable();
|
|
||||||
$table->timestamp('created_at')->useCurrent();
|
$table->timestamp('created_at')->useCurrent();
|
||||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||||
$table->softDeletes();
|
$table->softDeletes();
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('egg_collections', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('egg_collections', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user