resource setup

This commit is contained in:
Russ Long 2022-09-04 13:57:38 -04:00
parent 8f95e68e61
commit e484c0df98
10 changed files with 66 additions and 9 deletions

View File

@ -19,6 +19,8 @@ class BiddersResource extends Resource
{
protected static ?string $model = Bidders::class;
protected static ?string $recordTitleAttribute = 'idbidders';
protected static ?string $navigationIcon = 'heroicon-o-collection';
protected static ?string $navigationGroup = 'Silent Auction';
@ -67,7 +69,9 @@ class BiddersResource extends Resource
public static function getRelations(): array
{
return [
//
RelationManagers\VehiclesRelationManager::class,
RelationManagers\CheckoutRelationManager::class,
RelationManagers\WinningBidsRelationManager::class,
];
}

View File

@ -37,7 +37,16 @@ class CheckoutResource extends Resource
{
return $table
->columns([
//
TextColumn::make('bidders.bidder_assigned_number')
->label('Bidder Number')
->sortable(),
TextColumn::make('winnertotal')
->label('Total Amount')
->money('usd', 'true')
->sortable(),
TextColumn::make('paymentMethod.pm_name')
->label('Payment Method')
->sortable(),
])
->filters([
//

View File

@ -37,7 +37,19 @@ class ItemsResource extends Resource
{
return $table
->columns([
//
TextColumn::make('item_assigned_num')
->label('Item Number')
->sortable(),
TextColumn::make('item_desc')
->label('Description'),
TextColumn::make('item_min_bid')
->label('Minimum Bid')
->money('usd', 'true')
->sortable(),
TextColumn::make('item_est_value')
->label('Estimated Value')
->money('usd', 'true')
->sortable(),
])
->filters([
//

View File

@ -22,7 +22,18 @@ class VehicleOwnerRelationManager extends RelationManager
->schema([
Forms\Components\Select::make('bidder_assigned_number')
->label('Number')
->required(),
->required()
->createOptionForm([
Forms\Components\TextInput::make('bidder_fname')->label('First Name'),
Forms\Components\TextInput::make('bidder_lname')->label('Last Name'),
Forms\Components\TextInput::make('bidder_addr')->label('Address'),
Forms\Components\TextInput::make('bidder_city')->label('City'),
Forms\Components\TextInput::make('bidder_state')->label('State'),
Forms\Components\TextInput::make('bidder_zip')->label('Zip'),
Forms\Components\TextInput::make('bidder_phone')->label('Phone Number'),
Forms\Components\TextInput::make('bidder_email')->label('Email'),
Forms\Components\TextInput::make('bidder_assigned_number')->label('Assigned Number'),
]),
]);
}

View File

@ -9,20 +9,26 @@ use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use App\Models\CarShowCategory;
class VehicleTypeRelationManager extends RelationManager
{
protected static string $relationship = 'vehicleType';
protected static ?string $recordTitleAttribute = 'type';
protected static ?string $recordTitleAttribute = 'id';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('category_name')
Forms\Components\Select::make('category_name')
->required()
->maxLength(255),
->searchable()
->options(CarShowCategory::vehtype()->pluck('category_name', 'id'))
->createOptionForm([
Forms\Components\TextInput::make('category_name'),
Forms\Components\Toggle::make('vehicle_type')->inline(false),
]),
]);
}

View File

@ -7,6 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Bidders extends Model
{
protected $table = 'bidders';
protected $primaryKey = 'idbidders';
protected $fillable = [
'bidder_fname',
'bidder_lname',

View File

@ -7,6 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Checkout extends Model
{
protected $table = 'checkout';
protected $primaryKey = 'checkout_id';
protected $fillable = [
'bidder_num',
'winnertotal',
@ -25,11 +28,11 @@ class Checkout extends Model
public function bidders()
{
return $this->belongsTo(Bidders::class, 'idbidders');
return $this->belongsTo(Bidders::class, 'bidder_num');
}
public function paymentMethod()
{
return $this->hasMany(PaymentMethods::class, 'payment_method', 'pm_id');
return $this->hasMany(PaymentMethods::class, 'pm_id', 'payment_method');
}
}

View File

@ -7,6 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Items extends Model
{
protected $table = 'items';
protected $primaryKey = 'iditems';
protected $fillable = [
'item_desc',
'item_min_bid',

View File

@ -7,6 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class PaymentMethods extends Model
{
protected $table = 'payment_methods';
protected $primaryKey = 'pm_id';
protected $fillable = [
'pm_name',
'created_at',

View File

@ -7,6 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class WinningBids extends Model
{
protected $table = 'winning_bids';
protected $primaryKey = 'idwinning_bids';
protected $fillable = [
'winning_bidder_num',
'winning_cost',