This commit is contained in:
Lizandro Guarnizo
2026-01-28 14:54:45 -05:00
parent 2eef39c2ea
commit 861d507536
3 changed files with 38 additions and 5 deletions
+2 -3
View File
@@ -39,8 +39,7 @@ class TelaResource extends Resource
->required()
->helperText('Ej: Algodón, Poliéster, Denim'),
FileUpload::make('foto')->image()->directory('telas')->disk('public')->visibility('public')->maxSize(1024)->imageEditor()->imageEditorAspectRatios(['16:9','4:3','1:1'])->helperText('Selecciona una imagen de la tela (máx. 1MB)')->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])->downloadable()->openable()->nullable()
,
ColorPicker::make('color')->default('#000000'),
@@ -87,7 +86,7 @@ class TelaResource extends Resource
{
return $table
->columns([
Tables\Columns\ImageColumn::make('foto')->disk('public'),
Tables\Columns\TextColumn::make('codigo')->searchable(),
Tables\Columns\TextColumn::make('tipo')->searchable(),
Tables\Columns\TextColumn::make('color')->searchable(),
-2
View File
@@ -9,7 +9,6 @@ class Tela extends Model
protected $fillable = [
'codigo',
'tipo',
'foto',
'color',
'proveedor_id',
'metros_comprados',
@@ -21,7 +20,6 @@ class Tela extends Model
];
protected $casts = [
'foto' => 'string',
'valor_total' => 'decimal:2',
'costo_por_metro' => 'decimal:2',
];
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('telas', function (Blueprint $table) {
if (Schema::hasColumn('telas', 'foto')) {
$table->dropColumn('foto');
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('telas', function (Blueprint $table) {
if (! Schema::hasColumn('telas', 'foto')) {
$table->string('foto')->nullable()->after('tipo');
}
});
}
};