various fixes

add modal for images
add various new .env configurations
This commit is contained in:
ShuriZma 2023-10-14 12:45:53 +02:00
parent ab6f702569
commit 801ae7c403
Signed by: ShuriZma
GPG Key ID: 8D289758EE9B8074
17 changed files with 449 additions and 275 deletions

View File

@ -7,6 +7,13 @@ APP_URL=http://localhost # domain of your website. might want to use "https" ins
APP_COPYRIGHT=ShuriZma APP_COPYRIGHT=ShuriZma
APP_COPYRIGHT_SINCE=2023 APP_COPYRIGHT_SINCE=2023
FOOTER_IMAGE=img/header.png # can be any image type. path should start from public/ (ex. 'img/header.png') FOOTER_IMAGE=img/header.png # can be any image type. path should start from public/ (ex. 'img/header.png')
LANDING_PAGE=false # if set to true a landing page will be added, if false the vehicle list is the landing page
# VEHICLE LIST
CURRENCY=$ # unit for prices etc
SPEED_UNIT=km/h # unit for top speed
FUEL_VOLUME_UNIT=l # unit for fuel volume
FIELDS=image,id,name,brand,class,storage,fuel_type,fuel_volume,seats,top_speed,price,vendor # list of fields that should be visible on the vehicle list (comma seperated). possible fields: image,id,name,brand,class,storage,fuel_type,fuel_volume,seats,top_speed,price,vendor
LOG_CHANNEL=stack LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null LOG_DEPRECATIONS_CHANNEL=null

View File

@ -19,7 +19,7 @@ class VehicleController extends Controller
public function index() public function index()
{ {
$vehicles = Vehicle::filter( $vehicles = Vehicle::filter(
request(['search', 'vehicle_class_id', 'brandId', 'fuelTypeId', 'vendorId']) request(['search', 'vehicle_class_id', 'brand_id', 'fuel_type_id', 'vendor_id'])
) )
->paginate(24)->withQueryString(); ->paginate(24)->withQueryString();

View File

@ -12,19 +12,19 @@ use Illuminate\Support\Carbon;
/** /**
* App\Models\Brand * App\Models\Brand
* *
* @property int $id * @property int $brand_id
* @property Carbon|null $created_at * @property Carbon|null $created_at
* @property Carbon|null $updated_at * @property Carbon|null $updated_at
* @property string $name * @property string $brand_name
* @property string|null $description * @property string|null $brand_description
* @method static \Database\Factories\BrandFactory factory($count = null, $state = []) * @method static BrandFactory factory($count = null, $state = [])
* @method static Builder|Brand newModelQuery() * @method static Builder|Brand newModelQuery()
* @method static Builder|Brand newQuery() * @method static Builder|Brand newQuery()
* @method static Builder|Brand query() * @method static Builder|Brand query()
* @method static Builder|Brand whereBrandDescription($value)
* @method static Builder|Brand whereBrandId($value)
* @method static Builder|Brand whereBrandName($value)
* @method static Builder|Brand whereCreatedAt($value) * @method static Builder|Brand whereCreatedAt($value)
* @method static Builder|Brand whereDescription($value)
* @method static Builder|Brand whereId($value)
* @method static Builder|Brand whereName($value)
* @method static Builder|Brand whereUpdatedAt($value) * @method static Builder|Brand whereUpdatedAt($value)
* @mixin Eloquent * @mixin Eloquent
*/ */
@ -35,19 +35,19 @@ class Brand extends Model
/** /**
* @return int * @return int
*/ */
public function getId(): int public function getBrandId(): int
{ {
return $this->id; return $this->brand_id;
} }
/** /**
* @param int $id * @param int $brand_id
* *
* @return Brand * @return Brand
*/ */
public function setId(int $id): Brand public function setBrandId(int $brand_id): Brand
{ {
$this->id = $id; $this->brand_id = $brand_id;
return $this; return $this;
} }
@ -55,19 +55,19 @@ class Brand extends Model
/** /**
* @return string * @return string
*/ */
public function getName(): string public function getBrandName(): string
{ {
return $this->name; return $this->brand_name;
} }
/** /**
* @param string $name * @param string $brand_name
* *
* @return Brand * @return Brand
*/ */
public function setName(string $name): Brand public function setBrandName(string $brand_name): Brand
{ {
$this->name = $name; $this->brand_name = $brand_name;
return $this; return $this;
} }
@ -75,19 +75,19 @@ class Brand extends Model
/** /**
* @return string|null * @return string|null
*/ */
public function getDescription(): ?string public function getBrandDescription(): ?string
{ {
return $this->description; return $this->brand_description;
} }
/** /**
* @param string|null $description * @param string|null $brand_description
* *
* @return Brand * @return Brand
*/ */
public function setDescription(?string $description): Brand public function setBrandDescription(?string $brand_description): Brand
{ {
$this->description = $description; $this->brand_description = $brand_description;
return $this; return $this;
} }

View File

@ -12,21 +12,21 @@ use Illuminate\Support\Carbon;
/** /**
* App\Models\FuelType * App\Models\FuelType
* *
* @property int $id * @property int $fuel_type_id
* @property Carbon|null $created_at * @property Carbon|null $created_at
* @property Carbon|null $updated_at * @property Carbon|null $updated_at
* @property string $name * @property string $fuel_type_name
* @property string|null $description * @property string|null $fuel_type_description
* @property float|null $price * @property float|null $fuel_type_price
* @method static \Database\Factories\FuelTypeFactory factory($count = null, $state = []) * @method static FuelTypeFactory factory($count = null, $state = [])
* @method static Builder|FuelType newModelQuery() * @method static Builder|FuelType newModelQuery()
* @method static Builder|FuelType newQuery() * @method static Builder|FuelType newQuery()
* @method static Builder|FuelType query() * @method static Builder|FuelType query()
* @method static Builder|FuelType whereCreatedAt($value) * @method static Builder|FuelType whereCreatedAt($value)
* @method static Builder|FuelType whereDescription($value) * @method static Builder|FuelType whereFuelTypeDescription($value)
* @method static Builder|FuelType whereId($value) * @method static Builder|FuelType whereFuelTypeId($value)
* @method static Builder|FuelType whereName($value) * @method static Builder|FuelType whereFuelTypeName($value)
* @method static Builder|FuelType wherePrice($value) * @method static Builder|FuelType whereFuelTypePrice($value)
* @method static Builder|FuelType whereUpdatedAt($value) * @method static Builder|FuelType whereUpdatedAt($value)
* @mixin Eloquent * @mixin Eloquent
*/ */
@ -37,19 +37,19 @@ class FuelType extends Model
/** /**
* @return int * @return int
*/ */
public function getId(): int public function getFuelTypeId(): int
{ {
return $this->id; return $this->fuel_type_id;
} }
/** /**
* @param int $id * @param int $fuel_type_id
* *
* @return FuelType * @return FuelType
*/ */
public function setId(int $id): FuelType public function setFuelTypeId(int $fuel_type_id): FuelType
{ {
$this->id = $id; $this->fuel_type_id = $fuel_type_id;
return $this; return $this;
} }
@ -57,19 +57,19 @@ class FuelType extends Model
/** /**
* @return string * @return string
*/ */
public function getName(): string public function getFuelTypeName(): string
{ {
return $this->name; return $this->fuel_type_name;
} }
/** /**
* @param string $name * @param string $fuel_type_name
* *
* @return FuelType * @return FuelType
*/ */
public function setName(string $name): FuelType public function setFuelTypeName(string $fuel_type_name): FuelType
{ {
$this->name = $name; $this->fuel_type_name = $fuel_type_name;
return $this; return $this;
} }
@ -77,19 +77,19 @@ class FuelType extends Model
/** /**
* @return string|null * @return string|null
*/ */
public function getDescription(): ?string public function getFuelTypeDescription(): ?string
{ {
return $this->description; return $this->fuel_type_description;
} }
/** /**
* @param string|null $description * @param string|null $fuel_type_description
* *
* @return FuelType * @return FuelType
*/ */
public function setDescription(?string $description): FuelType public function setFuelTypeDescription(?string $fuel_type_description): FuelType
{ {
$this->description = $description; $this->fuel_type_description = $fuel_type_description;
return $this; return $this;
} }
@ -97,19 +97,19 @@ class FuelType extends Model
/** /**
* @return float|null * @return float|null
*/ */
public function getPrice(): ?float public function getFuelTypePrice(): ?float
{ {
return $this->price; return $this->fuel_type_price;
} }
/** /**
* @param float|null $price * @param float|null $fuel_type_price
* *
* @return FuelType * @return FuelType
*/ */
public function setPrice(?float $price): FuelType public function setFuelTypePrice(?float $fuel_type_price): FuelType
{ {
$this->price = $price; $this->fuel_type_price = $fuel_type_price;
return $this; return $this;
} }

View File

@ -13,21 +13,20 @@ use Schema;
/** /**
* App\Models\Vehicle * App\Models\Vehicle
* *
* @property int $id * @property int $vehicle_id
* @property Carbon|null $created_at * @property Carbon|null $created_at
* @property Carbon|null $updated_at * @property Carbon|null $updated_at
* @property string $name * @property string $name
* @property string|null $image_path * @property int $vehicle_storage
* @property int $storage * @property int $vehicle_fuel_volume
* @property int $fuel_volume * @property int $vehicle_seats
* @property int $seats * @property float|null $vehicle_price
* @property float|null $price * @property float|null $vehicle_top_speed
* @property float|null $top_speed
* @property int $vehicle_class_id * @property int $vehicle_class_id
* @property int $fuel_type_id * @property int $fuel_type_id
* @property int $brand_id * @property int $brand_id
* @property int $vendor_id * @property int $vendor_id
* @method static \Database\Factories\VehicleFactory factory($count = null, $state = []) * @method static VehicleFactory factory($count = null, $state = [])
* @method static Builder|Vehicle filter(array $filters) * @method static Builder|Vehicle filter(array $filters)
* @method static Builder|Vehicle newModelQuery() * @method static Builder|Vehicle newModelQuery()
* @method static Builder|Vehicle newQuery() * @method static Builder|Vehicle newQuery()
@ -35,39 +34,95 @@ use Schema;
* @method static Builder|Vehicle whereBrandId($value) * @method static Builder|Vehicle whereBrandId($value)
* @method static Builder|Vehicle whereCreatedAt($value) * @method static Builder|Vehicle whereCreatedAt($value)
* @method static Builder|Vehicle whereFuelTypeId($value) * @method static Builder|Vehicle whereFuelTypeId($value)
* @method static Builder|Vehicle whereFuelVolume($value)
* @method static Builder|Vehicle whereId($value)
* @method static Builder|Vehicle whereImagePath($value)
* @method static Builder|Vehicle whereName($value) * @method static Builder|Vehicle whereName($value)
* @method static Builder|Vehicle wherePrice($value)
* @method static Builder|Vehicle whereSeats($value)
* @method static Builder|Vehicle whereStorage($value)
* @method static Builder|Vehicle whereTopSpeed($value)
* @method static Builder|Vehicle whereUpdatedAt($value) * @method static Builder|Vehicle whereUpdatedAt($value)
* @method static Builder|Vehicle whereVehicleClassId($value) * @method static Builder|Vehicle whereVehicleClassId($value)
* @method static Builder|Vehicle whereVehicleFuelVolume($value)
* @method static Builder|Vehicle whereVehicleId($value)
* @method static Builder|Vehicle whereVehiclePrice($value)
* @method static Builder|Vehicle whereVehicleSeats($value)
* @method static Builder|Vehicle whereVehicleStorage($value)
* @method static Builder|Vehicle whereVehicleTopSpeed($value)
* @method static Builder|Vehicle whereVendorId($value) * @method static Builder|Vehicle whereVendorId($value)
* @property string $vehicle_name
* @method static Builder|Vehicle whereVehicleName($value)
* @mixin Eloquent * @mixin Eloquent
*/ */
class Vehicle extends Model class Vehicle extends Model
{ {
use HasFactory; use HasFactory;
/** public function scopeFilter(
* @return int $query,
*/ array $filters
public function getId(): int ): void {
{ $search = $filters['search'] ?? false;
return $this->id; if ($search) {
$query->where('name', 'like', '%' . $search . '%');
}
unset($filters['search']);
$orderByOne = $filters['orderByOne'] ?? null;
$orderByTwo = $filters['orderByTwo'] ?? null;
if (!empty($orderByOne) || !empty($orderByTwo)) {
$orderBy = '';
if (!empty($orderByOne) && Schema::hasColumn('vehicles', $orderByOne)) {
$orderBy .= $orderByOne;
}
if (!empty($orderByTwo) && Schema::hasColumn('vehicles', $orderByTwo)) {
$orderBy .= empty($orderBy) ? $orderByTwo : ', ' . $orderByTwo;
}
$query->orderBy($orderBy);
}
foreach ($filters as $field => $filter) {
if (empty($filter)) {
continue;
}
switch ($field) {
case 'vehicle_class_id':
$query->join('vehicle_classes', 'vehicles.vehicle_class_id', '=', 'vehicle_classes.vehicle_class_id');
$query->where('vehicle_class_name', '=', $filter);
break;
case 'brand_id':
$query->join('brands', 'vehicles.brand_id', '=', 'brands.brand_id');
$query->where('brand_name', '=', $filter);
break;
case 'fuel_type_id':
$query->join('fuel_types', 'vehicles.fuel_type_id', '=', 'fuel_types.fuel_type_id');
$query->where('fuel_type_name', '=', $filter);
break;
case 'vendor_id':
$query->join('vendors', 'vehicles.vendor_id', '=', 'vendors.vendor_id');
$query->where('vendor_name', '=', $filter);
break;
default:
Schema::hasColumn('vehicles', $field);
$query->where($field, '=', $filter);
}
}
} }
/** /**
* @param int $id * @return int
*/
public function getVehicleId(): int
{
return $this->vehicle_id;
}
/**
* @param int $vehicle_id
* *
* @return Vehicle * @return Vehicle
*/ */
public function setId(int $id): Vehicle public function setVehicleId(int $vehicle_id): Vehicle
{ {
$this->id = $id; $this->vehicle_id = $vehicle_id;
return $this; return $this;
} }
@ -75,39 +130,19 @@ class Vehicle extends Model
/** /**
* @return string * @return string
*/ */
public function getName(): string public function getVehicleName(): string
{ {
return $this->name; return $this->vehicle_name;
} }
/** /**
* @param string $name * @param string $vehicle_name
* *
* @return Vehicle * @return Vehicle
*/ */
public function setName(string $name): Vehicle public function setVehicleName(string $vehicle_name): Vehicle
{ {
$this->name = $name; $this->vehicle_name = $vehicle_name;
return $this;
}
/**
* @return string|null
*/
public function getImagePath(): ?string
{
return $this->image_path;
}
/**
* @param string|null $image_path
*
* @return Vehicle
*/
public function setImagePath(?string $image_path): Vehicle
{
$this->image_path = $image_path;
return $this; return $this;
} }
@ -115,19 +150,19 @@ class Vehicle extends Model
/** /**
* @return int * @return int
*/ */
public function getStorage(): int public function getVehicleStorage(): int
{ {
return $this->storage; return $this->vehicle_storage;
} }
/** /**
* @param int $storage * @param int $vehicle_storage
* *
* @return Vehicle * @return Vehicle
*/ */
public function setStorage(int $storage): Vehicle public function setVehicleStorage(int $vehicle_storage): Vehicle
{ {
$this->storage = $storage; $this->vehicle_storage = $vehicle_storage;
return $this; return $this;
} }
@ -135,19 +170,19 @@ class Vehicle extends Model
/** /**
* @return int * @return int
*/ */
public function getFuelVolume(): int public function getVehicleFuelVolume(): int
{ {
return $this->fuel_volume; return $this->vehicle_fuel_volume;
} }
/** /**
* @param int $fuel_volume * @param int $vehicle_fuel_volume
* *
* @return Vehicle * @return Vehicle
*/ */
public function setFuelVolume(int $fuel_volume): Vehicle public function setVehicleFuelVolume(int $vehicle_fuel_volume): Vehicle
{ {
$this->fuel_volume = $fuel_volume; $this->vehicle_fuel_volume = $vehicle_fuel_volume;
return $this; return $this;
} }
@ -155,19 +190,19 @@ class Vehicle extends Model
/** /**
* @return int * @return int
*/ */
public function getSeats(): int public function getVehicleSeats(): int
{ {
return $this->seats; return $this->vehicle_seats;
} }
/** /**
* @param int $seats * @param int $vehicle_seats
* *
* @return Vehicle * @return Vehicle
*/ */
public function setSeats(int $seats): Vehicle public function setVehicleSeats(int $vehicle_seats): Vehicle
{ {
$this->seats = $seats; $this->vehicle_seats = $vehicle_seats;
return $this; return $this;
} }
@ -175,19 +210,19 @@ class Vehicle extends Model
/** /**
* @return float|null * @return float|null
*/ */
public function getPrice(): ?float public function getVehiclePrice(): ?float
{ {
return $this->price; return $this->vehicle_price;
} }
/** /**
* @param float|null $price * @param float|null $vehicle_price
* *
* @return Vehicle * @return Vehicle
*/ */
public function setPrice(?float $price): Vehicle public function setVehiclePrice(?float $vehicle_price): Vehicle
{ {
$this->price = $price; $this->vehicle_price = $vehicle_price;
return $this; return $this;
} }
@ -195,19 +230,19 @@ class Vehicle extends Model
/** /**
* @return float|null * @return float|null
*/ */
public function getTopSpeed(): ?float public function getVehicleTopSpeed(): ?float
{ {
return $this->top_speed; return $this->vehicle_top_speed;
} }
/** /**
* @param float|null $top_speed * @param float|null $vehicle_top_speed
* *
* @return Vehicle * @return Vehicle
*/ */
public function setTopSpeed(?float $top_speed): Vehicle public function setVehicleTopSpeed(?float $vehicle_top_speed): Vehicle
{ {
$this->top_speed = $top_speed; $this->vehicle_top_speed = $vehicle_top_speed;
return $this; return $this;
} }
@ -291,36 +326,4 @@ class Vehicle extends Model
return $this; return $this;
} }
public function scopeFilter(
$query,
array $filters
): void {
$search = $filters['search'] ?? false;
if ($search) {
$query->where('name', 'like', '%' . $search . '%');
}
unset($filters['search']);
$orderByOne = $filters['orderByOne'] ?? false;
$orderByTwo = $filters['orderByTwo'] ?? false;
if ($orderByOne || $orderByTwo) {
$orderBy = '';
if ($orderByOne && Schema::hasColumn('vehicles', $orderByOne)) {
$orderBy .= $orderByOne;
}
if ($orderByTwo && Schema::hasColumn('vehicles', $orderByTwo)) {
$orderBy .= empty($orderBy) ? $orderByTwo : ', ' . $orderByTwo;
}
$query->orderBy($orderBy);
}
foreach ($filters as $field => $filter) {
Schema::hasColumn('vehicles', $field);
$query->where($field, '=', $filter);
}
}
} }

View File

@ -12,20 +12,20 @@ use Illuminate\Support\Carbon;
/** /**
* App\Models\VehicleClass * App\Models\VehicleClass
* *
* @property int $id * @property int $vehicle_class_id
* @property Carbon|null $created_at * @property Carbon|null $created_at
* @property Carbon|null $updated_at * @property Carbon|null $updated_at
* @property string $name * @property string $vehicle_class_name
* @property string|null $description * @property string|null $vehicle_class_description
* @method static \Database\Factories\VehicleClassFactory factory($count = null, $state = []) * @method static VehicleClassFactory factory($count = null, $state = [])
* @method static Builder|VehicleClass newModelQuery() * @method static Builder|VehicleClass newModelQuery()
* @method static Builder|VehicleClass newQuery() * @method static Builder|VehicleClass newQuery()
* @method static Builder|VehicleClass query() * @method static Builder|VehicleClass query()
* @method static Builder|VehicleClass whereCreatedAt($value) * @method static Builder|VehicleClass whereCreatedAt($value)
* @method static Builder|VehicleClass whereDescription($value)
* @method static Builder|VehicleClass whereId($value)
* @method static Builder|VehicleClass whereName($value)
* @method static Builder|VehicleClass whereUpdatedAt($value) * @method static Builder|VehicleClass whereUpdatedAt($value)
* @method static Builder|VehicleClass whereVehicleClassDescription($value)
* @method static Builder|VehicleClass whereVehicleClassId($value)
* @method static Builder|VehicleClass whereVehicleClassName($value)
* @mixin Eloquent * @mixin Eloquent
*/ */
class VehicleClass extends Model class VehicleClass extends Model
@ -35,19 +35,19 @@ class VehicleClass extends Model
/** /**
* @return int * @return int
*/ */
public function getId(): int public function getVehicleClassId(): int
{ {
return $this->id; return $this->vehicle_class_id;
} }
/** /**
* @param int $id * @param int $vehicle_class_id
* *
* @return VehicleClass * @return VehicleClass
*/ */
public function setId(int $id): VehicleClass public function setVehicleClassId(int $vehicle_class_id): VehicleClass
{ {
$this->id = $id; $this->vehicle_class_id = $vehicle_class_id;
return $this; return $this;
} }
@ -55,19 +55,19 @@ class VehicleClass extends Model
/** /**
* @return string * @return string
*/ */
public function getName(): string public function getVehicleClassName(): string
{ {
return $this->name; return $this->vehicle_class_name;
} }
/** /**
* @param string $name * @param string $vehicle_class_name
* *
* @return VehicleClass * @return VehicleClass
*/ */
public function setName(string $name): VehicleClass public function setVehicleClassName(string $vehicle_class_name): VehicleClass
{ {
$this->name = $name; $this->vehicle_class_name = $vehicle_class_name;
return $this; return $this;
} }
@ -75,19 +75,19 @@ class VehicleClass extends Model
/** /**
* @return string|null * @return string|null
*/ */
public function getDescription(): ?string public function getVehicleClassDescription(): ?string
{ {
return $this->description; return $this->vehicle_class_description;
} }
/** /**
* @param string|null $description * @param string|null $vehicle_class_description
* *
* @return VehicleClass * @return VehicleClass
*/ */
public function setDescription(?string $description): VehicleClass public function setVehicleClassDescription(?string $vehicle_class_description): VehicleClass
{ {
$this->description = $description; $this->vehicle_class_description = $vehicle_class_description;
return $this; return $this;
} }

View File

@ -12,26 +12,26 @@ use Illuminate\Support\Carbon;
/** /**
* App\Models\Vendor * App\Models\Vendor
* *
* @property int $id * @property int $vendor_id
* @property Carbon|null $created_at * @property Carbon|null $created_at
* @property Carbon|null $updated_at * @property Carbon|null $updated_at
* @property string $name * @property string $vendor_name
* @property string|null $description * @property string|null $vendor_description
* @property string|null $position * @property string|null $vendor_position
* @property float|null $x * @property float|null $vendor_x
* @property float|null $y * @property float|null $vendor_y
* @method static \Database\Factories\VendorFactory factory($count = null, $state = []) * @method static VendorFactory factory($count = null, $state = [])
* @method static Builder|Vendor newModelQuery() * @method static Builder|Vendor newModelQuery()
* @method static Builder|Vendor newQuery() * @method static Builder|Vendor newQuery()
* @method static Builder|Vendor query() * @method static Builder|Vendor query()
* @method static Builder|Vendor whereCreatedAt($value) * @method static Builder|Vendor whereCreatedAt($value)
* @method static Builder|Vendor whereDescription($value)
* @method static Builder|Vendor whereId($value)
* @method static Builder|Vendor whereName($value)
* @method static Builder|Vendor wherePosition($value)
* @method static Builder|Vendor whereUpdatedAt($value) * @method static Builder|Vendor whereUpdatedAt($value)
* @method static Builder|Vendor whereX($value) * @method static Builder|Vendor whereVendorDescription($value)
* @method static Builder|Vendor whereY($value) * @method static Builder|Vendor whereVendorId($value)
* @method static Builder|Vendor whereVendorName($value)
* @method static Builder|Vendor whereVendorPosition($value)
* @method static Builder|Vendor whereVendorX($value)
* @method static Builder|Vendor whereVendorY($value)
* @mixin Eloquent * @mixin Eloquent
*/ */
class Vendor extends Model class Vendor extends Model
@ -41,19 +41,19 @@ class Vendor extends Model
/** /**
* @return int * @return int
*/ */
public function getId(): int public function getVendorId(): int
{ {
return $this->id; return $this->vendor_id;
} }
/** /**
* @param int $id * @param int $vendor_id
* *
* @return Vendor * @return Vendor
*/ */
public function setId(int $id): Vendor public function setVendorId(int $vendor_id): Vendor
{ {
$this->id = $id; $this->vendor_id = $vendor_id;
return $this; return $this;
} }
@ -61,19 +61,19 @@ class Vendor extends Model
/** /**
* @return string * @return string
*/ */
public function getName(): string public function getVendorName(): string
{ {
return $this->name; return $this->vendor_name;
} }
/** /**
* @param string $name * @param string $vendor_name
* *
* @return Vendor * @return Vendor
*/ */
public function setName(string $name): Vendor public function setVendorName(string $vendor_name): Vendor
{ {
$this->name = $name; $this->vendor_name = $vendor_name;
return $this; return $this;
} }
@ -81,19 +81,19 @@ class Vendor extends Model
/** /**
* @return string|null * @return string|null
*/ */
public function getDescription(): ?string public function getVendorDescription(): ?string
{ {
return $this->description; return $this->vendor_description;
} }
/** /**
* @param string|null $description * @param string|null $vendor_description
* *
* @return Vendor * @return Vendor
*/ */
public function setDescription(?string $description): Vendor public function setVendorDescription(?string $vendor_description): Vendor
{ {
$this->description = $description; $this->vendor_description = $vendor_description;
return $this; return $this;
} }
@ -101,19 +101,19 @@ class Vendor extends Model
/** /**
* @return string|null * @return string|null
*/ */
public function getPosition(): ?string public function getVendorPosition(): ?string
{ {
return $this->position; return $this->vendor_position;
} }
/** /**
* @param string|null $position * @param string|null $vendor_position
* *
* @return Vendor * @return Vendor
*/ */
public function setPosition(?string $position): Vendor public function setVendorPosition(?string $vendor_position): Vendor
{ {
$this->position = $position; $this->vendor_position = $vendor_position;
return $this; return $this;
} }
@ -121,19 +121,19 @@ class Vendor extends Model
/** /**
* @return float|null * @return float|null
*/ */
public function getX(): ?float public function getVendorX(): ?float
{ {
return $this->x; return $this->vendor_x;
} }
/** /**
* @param float|null $x * @param float|null $vendor_x
* *
* @return Vendor * @return Vendor
*/ */
public function setX(?float $x): Vendor public function setVendorX(?float $vendor_x): Vendor
{ {
$this->x = $x; $this->vendor_x = $vendor_x;
return $this; return $this;
} }
@ -141,19 +141,19 @@ class Vendor extends Model
/** /**
* @return float|null * @return float|null
*/ */
public function getY(): ?float public function getVendorY(): ?float
{ {
return $this->y; return $this->vendor_y;
} }
/** /**
* @param float|null $y * @param float|null $vendor_y
* *
* @return Vendor * @return Vendor
*/ */
public function setY(?float $y): Vendor public function setVendorY(?float $vendor_y): Vendor
{ {
$this->y = $y; $this->vendor_y = $vendor_y;
return $this; return $this;
} }

View File

@ -36,7 +36,6 @@ return new class extends Migration
}); });
Schema::table('vehicles', function (Blueprint $table) { Schema::table('vehicles', function (Blueprint $table) {
$table->string('name')->unique()->change();
$table->string('image_path')->nullable(true)->change(); $table->string('image_path')->nullable(true)->change();
$table->double('price')->nullable(true)->change(); $table->double('price')->nullable(true)->change();
$table->double('top_speed')->nullable(true)->change(); $table->double('top_speed')->nullable(true)->change();

View File

@ -0,0 +1,97 @@
<?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('vehicles', function (Blueprint $table) {
$table->renameColumn('id', 'vehicle_id');
$table->renameColumn('name', 'vehicle_name');
$table->dropColumn('image_path');
$table->renameColumn('storage', 'vehicle_storage');
$table->renameColumn('fuel_volume', 'vehicle_fuel_volume');
$table->renameColumn('seats', 'vehicle_seats');
$table->renameColumn('price', 'vehicle_price');
$table->renameColumn('top_speed', 'vehicle_top_speed');
});
Schema::table('vendors', function (Blueprint $table) {
$table->renameColumn('id', 'vendor_id');
$table->renameColumn('name', 'vendor_name');
$table->renameColumn('description', 'vendor_description');
$table->renameColumn('position', 'vendor_position');
$table->renameColumn('x', 'vendor_x');
$table->renameColumn('y', 'vendor_y');
});
Schema::table('brands', function (Blueprint $table) {
$table->renameColumn('id', 'brand_id');
$table->renameColumn('name', 'brand_name');
$table->renameColumn('description', 'brand_description');
});
Schema::table('vehicle_classes', function (Blueprint $table) {
$table->renameColumn('id', 'vehicle_class_id');
$table->renameColumn('name', 'vehicle_class_name');
$table->renameColumn('description', 'vehicle_class_description');
});
Schema::table('fuel_types', function (Blueprint $table) {
$table->renameColumn('id', 'fuel_type_id');
$table->renameColumn('name', 'fuel_type_name');
$table->renameColumn('description', 'fuel_type_description');
$table->renameColumn('price', 'fuel_type_price');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('vehicles', function (Blueprint $table) {
$table->renameColumn('vehicle_id', 'id');
$table->string('image_path')->nullable(true);
$table->renameColumn('vehicle_storage', 'storage');
$table->renameColumn('vehicle_fuel_volume', 'fuel_volume');
$table->renameColumn('vehicle_seats', 'seats');
$table->renameColumn('vehicle_price', 'price');
$table->renameColumn('vehicle_top_speed', 'top_speed');
});
Schema::table('vendors', function (Blueprint $table) {
$table->renameColumn('vendor_id', 'id');
$table->renameColumn('vendor_name', 'name');
$table->renameColumn('vendor_description', 'description');
$table->renameColumn('vendor_position', 'position');
$table->renameColumn('vendor_x', 'x');
$table->renameColumn('vendor_y', 'y');
});
Schema::table('brands', function (Blueprint $table) {
$table->renameColumn('brand_id', 'id');
$table->renameColumn('brand_name', 'name');
$table->renameColumn('brand_description', 'description');
});
Schema::table('vehicle_classes', function (Blueprint $table) {
$table->renameColumn('vehicle_class_id', 'id');
$table->renameColumn('vehicle_class_name', 'name');
$table->renameColumn('vehicle_class_description', 'description');
});
Schema::table('fuel_types', function (Blueprint $table) {
$table->renameColumn('fuel_type_id', 'id');
$table->renameColumn('fuel_type_name', 'name');
$table->renameColumn('fuel_type_description', 'description');
$table->renameColumn('fuel_type_price', 'price');
});
}
};

View File

@ -13244,6 +13244,15 @@ html{
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
} }
.modal-toggle{
position: fixed;
height: 0px;
width: 0px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
opacity: 0;
}
.select{ .select{
display: inline-flex; display: inline-flex;
flex-shrink: 0; flex-shrink: 0;
@ -14111,6 +14120,10 @@ html{
margin-left: -0.5rem; margin-left: -0.5rem;
margin-right: -0.5rem; margin-right: -0.5rem;
} }
.mx-2{
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.mx-8{ .mx-8{
margin-left: 2rem; margin-left: 2rem;
margin-right: 2rem; margin-right: 2rem;
@ -14288,6 +14301,9 @@ html{
.h-screen{ .h-screen{
height: 100vh; height: 100vh;
} }
.h-auto{
height: auto;
}
.max-h-\[20rem\]{ .max-h-\[20rem\]{
max-height: 20rem; max-height: 20rem;
} }
@ -14300,6 +14316,12 @@ html{
.max-h-\[90vh\]{ .max-h-\[90vh\]{
max-height: 90vh; max-height: 90vh;
} }
.max-h-32{
max-height: 8rem;
}
.max-h-\[70vh\]{
max-height: 70vh;
}
.min-h-\[15rem\]{ .min-h-\[15rem\]{
min-height: 15rem; min-height: 15rem;
} }
@ -14381,6 +14403,9 @@ html{
.min-w-\[20rem\]{ .min-w-\[20rem\]{
min-width: 20rem; min-width: 20rem;
} }
.min-w-\[6rem\]{
min-width: 6rem;
}
.min-w-full{ .min-w-full{
min-width: 100%; min-width: 100%;
} }
@ -14406,6 +14431,9 @@ html{
.max-w-\[40rem\]{ .max-w-\[40rem\]{
max-width: 40rem; max-width: 40rem;
} }
.max-w-\[8rem\]{
max-width: 8rem;
}
.max-w-md{ .max-w-md{
max-width: 28rem; max-width: 28rem;
} }
@ -14416,6 +14444,12 @@ html{
.max-w-xl{ .max-w-xl{
max-width: 36rem; max-width: 36rem;
} }
.max-w-\[120rem\]{
max-width: 120rem;
}
.max-w-\[100rem\]{
max-width: 100rem;
}
.flex-1{ .flex-1{
flex: 1 1 0%; flex: 1 1 0%;
} }
@ -14461,6 +14495,9 @@ html{
.cursor-default{ .cursor-default{
cursor: default; cursor: default;
} }
.cursor-pointer{
cursor: pointer;
}
.grid-cols-1{ .grid-cols-1{
grid-template-columns: repeat(1, minmax(0, 1fr)); grid-template-columns: repeat(1, minmax(0, 1fr));
} }

View File

@ -0,0 +1,5 @@
@props(['image', 'id'])
<input type="checkbox" id="{{ $id }}" class="modal-toggle" />
<div class="modal">
<label class="w-full h-full flex" for="{{ $id }}"><img class="w-auto max-h-[70vh] m-auto" src="{{ asset($image) }}"></label>
</div>

View File

@ -47,7 +47,7 @@
<header> <header>
<div class="h-[6rem] bg-zinc-800 -mx-2 flex"> <div class="h-[6rem] bg-zinc-800 -mx-2 flex">
<div class="my-auto mx-auto flex"> <div class="my-auto mx-auto flex">
<img src="{{ asset('img/shurizma.png') }}" alt="" class="h-[3.5rem]"/> <img src="{{ asset('img/logo.png') }}" alt="" class="h-[3.5rem] mx-2"/>
<div> <div>
<h2 class="text-lg font-bold text-red-400">{{ env('APP_NAME') }}</h2> <h2 class="text-lg font-bold text-red-400">{{ env('APP_NAME') }}</h2>
<p>{{ env('APP_TITLE') }}</p> <p>{{ env('APP_TITLE') }}</p>

View File

@ -12,11 +12,13 @@
</div> </div>
<div class="flex-1"> <div class="flex-1">
<ul class="pt-2 pb-4 space-y-1 text-sm"> <ul class="pt-2 pb-4 space-y-1 text-sm">
@if(env('LANDING_PAGE', false))
<x-layout.sidebar.list-element href="{{ route('home') }}" title="{{ __('Home') }}"> <x-layout.sidebar.list-element href="{{ route('home') }}" title="{{ __('Home') }}">
<x-slot:icon> <x-slot:icon>
<i class="fa-solid fa-house-chimney fa-lg text-red-400"></i> <i class="fa-solid fa-house-chimney fa-lg text-red-400"></i>
</x-slot:icon> </x-slot:icon>
</x-layout.sidebar.list-element> </x-layout.sidebar.list-element>
@endif
<x-layout.sidebar.list-element href="{{ route('vehicles') }}" title="{{ __('Vehicles') }}" class="h-[2rem]"> <x-layout.sidebar.list-element href="{{ route('vehicles') }}" title="{{ __('Vehicles') }}" class="h-[2rem]">
<x-slot:icon> <x-slot:icon>
<i class="fa-solid fa-car fa-lg text-red-400"></i> <i class="fa-solid fa-car fa-lg text-red-400"></i>

View File

@ -5,12 +5,12 @@
$type = $args['type']; $type = $args['type'];
$value = $args['value'] ?? ($type === 'int' ? 0 : ''); $value = $args['value'] ?? ($type === 'int' ? 0 : '');
$rowType = 'div'; $rowType = 'div';
$classes = ['p-3 border-opacity-40 border-red-400 grow basis-0 border min-w-[10rem] min-h-[5rem]', ($type === 'int' ? 'text-right' : 'text-left'), ($mode === 'tableVertical' ? 'min-w-[10rem] min-h-[5rem]' : ''), ($header ? 'font-bold' : '')]; $classes = ['p-3 border-opacity-40 border-red-400 grow basis-0 border min-w-[6rem]', ($type === 'int' ? 'text-right' : 'text-left'), ($mode === 'tableVertical' ? 'max-w-[8rem] min-h-[5rem]' : ''), ($header ? 'font-bold' : '')];
$html = '<' . $rowType . ' class="' . implode(' ', $classes) . '">'; $html = '<' . $rowType . ' class="' . implode(' ', $classes) . '">';
$valueHtml = match ($type) { $valueHtml = match ($type) {
'string' => $value, 'string' => $value,
'int' => $value . ($args['unit'] ?? ''), 'int' => $value . ($args['unit'] ?? ''),
'image' => '<img class="max-h-[3.5rem]" src="' . $value . '" alt="' . $field . '">' 'image' => '<label for="image_modal_' . $value . '"><img class="max-h-[3.5rem] cursor-pointer" src="' . $value . '" alt="' . $field . '"></label>'
}; };
if (!empty($args['link'])) { if (!empty($args['link'])) {
@ -28,5 +28,8 @@
<div class="bg-zinc-800 hover:bg-zinc-700 first:hover:bg-zinc-800 flex {{ $mode === 'tableVertical' ? 'flex-col' : 'last:rounded-b-[1rem] first:rounded-t-[1rem]' }} {{ $header ? 'sticky self-start ' . ($mode === 'tableVertical' ? 'left-0' : 'top-0') : '' }}"> <div class="bg-zinc-800 hover:bg-zinc-700 first:hover:bg-zinc-800 flex {{ $mode === 'tableVertical' ? 'flex-col' : 'last:rounded-b-[1rem] first:rounded-t-[1rem]' }} {{ $header ? 'sticky self-start ' . ($mode === 'tableVertical' ? 'left-0' : 'top-0') : '' }}">
@foreach($values as $field => $value) @foreach($values as $field => $value)
{!! getFieldHtml($value, $field, $header, $mode) !!} {!! getFieldHtml($value, $field, $header, $mode) !!}
@if($value['type'] === 'image')
<x-image-modal image="{{ $value['value'] }}" id="image_modal_{{ $value['value'] }}" />
@endif
@endforeach @endforeach
</div> </div>

View File

@ -7,22 +7,23 @@
<div <div
class="flex flex-col w-full max-w-[40rem] min-h-[40rem] p-6 space-y-6 overflow-hidden rounded-lg shadow-md bg-zinc-800 text-red-400 m-auto border border-red-400"> class="flex flex-col w-full max-w-[40rem] min-h-[40rem] p-6 space-y-6 overflow-hidden rounded-lg shadow-md bg-zinc-800 text-red-400 m-auto border border-red-400">
<div> <div>
<img src="{{ asset('img/vehicles/' . $vehicle->getImagePath()) }}" alt="Photo of {{ $vehicle->getName() }}" <label for="image_modal_{{ 'img/vehicles/' . $vehicle->getVehicleId() . '.png' }}"><img src="{{ asset('img/vehicles/' . $vehicle->getVehicleId() . '.png') }}" alt="Photo of {{ $vehicle->getVehicleName() }}"
class="rounded-xl" width="100%"> class="rounded-xl cursor-pointer" width="100%"></label>
<x-image-modal image="{{ 'img/vehicles/' . $vehicle->getVehicleId() . '.png' }}" id="image_modal_{{ 'img/vehicles/' . $vehicle->getVehicleId() . '.png' }}"/>
</div> </div>
<div class="flex flex-col justify-between flex-1"> <div class="flex flex-col justify-between flex-1">
<header> <header>
<div class="mt-4"> <div class="mt-4">
<h1 class="text-3xl clamp one-line">{{ $vehicle->getName() }}</h1> <h1 class="text-3xl clamp one-line">{{ $vehicle->getVehicleName() }}</h1>
<span class="mt-2 block text-zinc-400 text-xs">{{ __('Brand') }}: {{ $brand }}</span> <span class="mt-2 block text-zinc-400 text-xs">{{ __('Brand') }}: {{ $brand }}</span>
<span class="mt-2 block text-zinc-400 text-xs">{{ __('Class') }}: {{ $class }}</span> <span class="mt-2 block text-zinc-400 text-xs">{{ __('Class') }}: {{ $class }}</span>
<span class="mt-2 block text-zinc-400 text-xs">{{ __('Storage') }}: {{ $vehicle->getStorage() }}</span> <span class="mt-2 block text-zinc-400 text-xs">{{ __('Storage') }}: {{ $vehicle->getVehicleStorage() }}</span>
<span class="mt-2 block text-zinc-400 text-xs">{{ __('Fuel Type') }}: {{ $fuelType }}</span> <span class="mt-2 block text-zinc-400 text-xs">{{ __('Fuel Type') }}: {{ $fuelType }}</span>
<span class="mt-2 block text-zinc-400 text-xs">{{ __('Fuel Volume') }}: {{ $vehicle->getFuelVolume() }}</span> <span class="mt-2 block text-zinc-400 text-xs">{{ __('Fuel Volume') }}: {{ $vehicle->getVehicleFuelVolume() }}</span>
<span class="mt-2 block text-zinc-400 text-xs">{{ __('Seats') }}: {{ $vehicle->getSeats() }}</span> <span class="mt-2 block text-zinc-400 text-xs">{{ __('Seats') }}: {{ $vehicle->getVehicleSeats() }}</span>
<span class="mt-2 block text-zinc-400 text-xs">{{ __('Price') }}: {{ $vehicle->getPrice() }}</span> <span class="mt-2 block text-zinc-400 text-xs">{{ __('Price') }}: {{ $vehicle->getVehiclePrice() }}</span>
<span class="mt-2 block text-zinc-400 text-xs">{{ __('Top Speed') }}: {{ $vehicle->getTopSpeed() }}</span> <span class="mt-2 block text-zinc-400 text-xs">{{ __('Top Speed') }}: {{ $vehicle->getVehicleTopSpeed() }}</span>
</div> </div>
</header> </header>

View File

@ -13,19 +13,20 @@
placeholder="Select Game or AppId" templateResult="true" placeholder="Select Game or AppId" templateResult="true"
templateSelection="true" text="item.name + '|AppID: ' + item.appID"> templateSelection="true" text="item.name + '|AppID: ' + item.appID">
<x-select-dropdown-hover alpineVariable="vehicle_class_id" placeholder="Pick a Vehicle Class..." <x-select-dropdown-hover alpineVariable="vehicle_class_id" placeholder="Pick a Vehicle Class..."
:enums="$vehicleClasses" functionCall="getDescription"/> :enums="$vehicleClasses" functionCall="getVehicleClassName"/>
<x-select-dropdown-hover alpineVariable="brand_id" placeholder="Pick a Brand..." <x-select-dropdown-hover alpineVariable="brand_id" placeholder="Pick a Brand..."
:enums="$brands" functionCall="getDescription"/> :enums="$brands" functionCall="getBrandName"/>
<x-select-dropdown-hover alpineVariable="fuel_type_id" placeholder="Pick a Fuel Type..." <x-select-dropdown-hover alpineVariable="fuel_type_id" placeholder="Pick a Fuel Type..."
:enums="$fuelTypes"/> :enums="$fuelTypes" functionCall="getFuelTypeName"/>
<x-select-dropdown-hover alpineVariable="vendor_id" placeholder="Pick a Vendor..." <x-select-dropdown-hover alpineVariable="vendor_id" placeholder="Pick a Vendor..."
:enums="$vendors"/> :enums="$vendors" functionCall="getVendorName"/>
<x-select-dropdown-hover alpineVariable="listMode" :enums="['gridCards', 'tableHorizontal', 'tableVertical']" placeholder="Pick a display mode for the list..." default="gridCards"/> <x-select-dropdown-hover alpineVariable="listMode" :enums="['gridCards', 'tableHorizontal', 'tableVertical']" placeholder="Pick a display mode for the list..." default="gridCards"/>
</x-searchbar-select2> </x-searchbar-select2>
</x-slot> </x-slot>
@php @php
$values = [[ $fields = explode(',', env('FIELDS', ''));
'image_path' => ['type' => 'string', 'value' => __('Photo')], $headerValues = [
'image' => ['type' => 'string', 'value' => __('Photo'),],
'id' => ['type' => 'string', 'value' => __('Id')], 'id' => ['type' => 'string', 'value' => __('Id')],
'name' => ['type' => 'string', 'value' => __('Name')], 'name' => ['type' => 'string', 'value' => __('Name')],
'brand' => ['type' => 'string', 'value' => __('Brand')], 'brand' => ['type' => 'string', 'value' => __('Brand')],
@ -37,33 +38,48 @@
'top_speed' => ['type' => 'string', 'value' => __('Top Speed')], 'top_speed' => ['type' => 'string', 'value' => __('Top Speed')],
'price' => ['type' => 'string', 'value' => __('Price')], 'price' => ['type' => 'string', 'value' => __('Price')],
'vendor' => ['type' => 'string', 'value' => __('Vendor')], 'vendor' => ['type' => 'string', 'value' => __('Vendor')],
]];
foreach ($vehicles as $key => $vehicle) {
$values[] = [
'image_path' => ['type' => 'image', 'value' => asset('img/vehicles/' . $vehicle->getImagePath())],
'id' => ['type' => 'int', 'value' => $game->getId()],
'name' => ['type' => 'string', 'value' => $game->getName()],
'brand' => ['type' => 'string', 'value' => $brands->firstWhere('id', '=', $vehicle->getBrandId())->getName()],
'class' => ['type' => 'string', 'value' => $vehicleClasses->firstWhere('id', '=', $vehicle->getVehicleClassId())->getName()],
'storage' => ['type' => 'int', 'value' => $vehicle->getStorage()],
'fuel_type' => ['type' => 'string', 'value' => $fuelTypes->firstWhere('id', '=', $vehicle->getFuelTypeId())->getName()],
'fuel_volume' => ['type' => 'int', 'value' => $vehicle->getFuelVolume()],
'seats' => ['type' => 'int', 'value' => $vehicle->getSeats()],
'top_speed' => ['type' => 'int', 'value' => $vehicle->getTopSpeed()],
'price' => ['type' => 'int', 'value' => $vehicle->getPrice(), 'unit' => env('CURRENCY', '$')],
'vendor' => ['type' => 'string', 'value' => $vendors->firstWhere('id', '=', $vehicle->getVendorId())->getName()],
]; ];
$values = [];
foreach ($fields as $field) {
$values[0][$field] = $headerValues[$field];
}
$index = 0;
foreach ($vehicles as $key => $vehicle) {
$index++;
$fieldValues = [
'image' => ['type' => 'image', 'value' => asset('img/vehicles/' . $vehicle->getVehicleId() . '.png')],
'id' => ['type' => 'int', 'value' => $vehicle->getVehicleId()],
'name' => ['type' => 'string', 'value' => $vehicle->getVehicleName()],
'brand' => ['type' => 'string', 'value' => $brands->firstWhere('brand_id', '=', $vehicle->getBrandId())->getBrandName()],
'class' => ['type' => 'string', 'value' => $vehicleClasses->firstWhere('vehicle_class_id', '=', $vehicle->getVehicleClassId())->getVehicleClassName()],
'storage' => ['type' => 'int', 'value' => $vehicle->getVehicleStorage()],
'fuel_type' => ['type' => 'string', 'value' => $fuelTypes->firstWhere('fuel_type_id', '=', $vehicle->getFuelTypeId())->getFuelTypeName()],
'fuel_volume' => ['type' => 'int', 'value' => $vehicle->getVehicleFuelVolume(), 'unit' => env('FUEL_VOLUME_UNIT', 'l')],
'seats' => ['type' => 'int', 'value' => $vehicle->getVehicleSeats()],
'top_speed' => ['type' => 'int', 'value' => $vehicle->getVehicleTopSpeed(), 'unit' => env('SPEED_UNIT', 'km/h')],
'price' => ['type' => 'int', 'value' => $vehicle->getVehiclePrice(), 'unit' => env('CURRENCY', '$')],
'vendor' => ['type' => 'string', 'value' => $vendors->firstWhere('vendor_id', '=', $vehicle->getVendorId())->getVendorName()],
];
foreach ($fields as $field) {
$values[$index][$field] = $fieldValues[$field];
}
} }
@endphp @endphp
@switch(app('request')->input('listMode')) @switch(app('request')->input('listMode') ?? env('DEFAULT_DISPLAY_MODE'))
@case('tableHorizontal') @case('tableHorizontal')
@case('tableVertical') @case('tableVertical')
<x-table.table :mode="app('request')->input('listMode')" :values="$values" /> <x-table.table :mode="app('request')->input('listMode') ?? env('DEFAULT_DISPLAY_MODE')" :values="$values" />
@break @break
@default @default
<x-grid> <x-grid>
@foreach($vehicles as $key => $vehicle) @foreach($vehicles as $key => $vehicle)
<x-vehicles.card :vehicle="$vehicle"/> <x-vehicles.card :vehicle="$vehicle"
:brand="$brands->firstWhere('brand_id', '=', $vehicle->getBrandId())->getBrandName()"
:class="$vehicleClasses->firstWhere('vehicle_class_id', '=', $vehicle->getVehicleClassId())->getVehicleClassName()"
:vendor="$vendors->firstWhere('vendor_id', '=', $vehicle->getVendorId())->getVendorName()"
:fuel-type="$fuelTypes->firstWhere('fuel_type_id', '=', $vehicle->getFuelTypeId())->getFuelTypeName()"/>
@endforeach @endforeach
</x-grid> </x-grid>
@endswitch @endswitch

View File

@ -16,6 +16,10 @@ use Illuminate\Support\Facades\Route;
*/ */
Route::get('/', static function () { Route::get('/', static function () {
if (!env('LANDING_PAGE', false)) {
return redirect(route('vehicles'));
}
return view('home'); return view('home');
})->name('home'); })->name('home');