This commit is contained in:
Lizandro Guarnizo
2026-01-29 16:36:29 -05:00
parent 3ce9d9d478
commit 75bb6d0aa1
2 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ class TelaResource extends Resource
ColorPicker::make('color')->default('#000000'),
Select::make('proveedor_id')
->relationship('proveedor', 'nombre', fn(\Illuminate\Database\Eloquent\Builder $q) => $q->where('categoria', 'telas'))
->options(fn() => \App\Models\Proveedor::where('categoria', 'telas')->pluck('nombre', 'id')->toArray())
->searchable()
->preload()
->required(),
+18
View File
@@ -0,0 +1,18 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
use App\Models\Proveedor;
try {
$rows = Proveedor::where('categoria', 'telas')->get();
echo "Found " . $rows->count() . " proveedores with categoria=telas\n";
foreach ($rows as $r) {
echo "- {$r->id}: {$r->nombre} ({$r->categoria})\n";
}
} catch (Throwable $e) {
echo "Error: " . get_class($e) . " - " . $e->getMessage() . "\n";
echo $e->getTraceAsString();
}