среда < /h4>
[list]
[*] laravel 12+< /li>
контейнер Docker (последнее изображение) < /li>
Php 8.2 < /li>
< /ul>
, когда я не работает, но в рамках меня. Точный тот же код в контейнере Docker, я получаю эту ошибку:
class "App \ model V ). Класс определенно существует в App/Models/efaceClestatus.php с правильным пространством имен. Файл модели существует и имеет правильное пространство имен: приложение имен пространство \ models;
Другие модели работают нормально, только эта одна конкретная модель
структура кода
[code]app/Models/Vehicle.php[/code]
Код: Выделить всё
public function availabilityRecords(): HasMany
{
return $this->hasMany(VehicleStatus::class);
}
< /code>
[h4]app/Models/VehicleStatus.phpnamespace App\Models;
class VehicleStatus extends Model
{
// ... model code
}
< /code>
Vehicle.php
protected $fillable = ['registration_number',
'brand',
'model',
'year',
'vehicle_release_date',
'mileage',
'number_of_seats',
'fuel_type',
'status',
'rental_price_per_day',
'gearbox_type',
'air_conditioning',
'vehicle_type',
'is_sub_rental',
'partner_id',
'rental_price_per_day_from_partner',
];
protected $casts = [
'status' => VehicleStatuses::class,
'is_sub_rental' => 'boolean',
'air_conditioning' => 'boolean',
'rental_price_per_day' => 'decimal:2',
'rental_price_per_day_from_partner' => 'decimal:2',
'vehicle_release_date' => 'date:Y-m-d',
'year' => 'integer',
'mileage' => 'integer',
'number_of_seats' => 'integer',
];
// Relationships
public function bookings(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(Booking::class);
}
public function partner(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Partner::class);
}
public function insurances(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Insurance::class);
}
public function otherMaintenances(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(OtherMaintenance::class);
}
public function technicalInspection(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(TechnicalInspection::class);
}
public function oilChanges(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(OilChange::class);
}
public function vehicleTaxes(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(VehicleTax::class);
}
// Fixed relationship - explicitly specify the model class
public function availabilityRecords(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(VehicleStatus::class, 'vehicle_id');
}
< /code>
VehicleStatus.php
protected $fillable = ['vehicle_id',
'booking_id',
'start_date_timestamp',
'end_date_timestamp',
'status',
];
protected $casts = [
'status' => VehicleStatuses::class,
'start_date_timestamp' => 'datetime:Y-m-d H:i',
'end_date_timestamp' => 'datetime:Y-m-d H:i',
];
// Relationships
public function vehicle() : BelongsTo
{
return $this->belongsTo(Vehicle::class);
}
public function booking() : BelongsTo
{
return $this->belongsTo(Booking::class);
}
< /code>
What I've tried
composer dump-autoload[*]php artisan cache:clear
[*]php artisan config:clear
[*]Restarting container
[*]Rebuilding image from scratch
[*]Verified file exists and has correct case
[/list]
The Mystery
Why would Laravel's autoloader work locally but not in Docker? Has anyone experienced this case-sensitivity issue specifically with Docker containers?Looking for insights on what could cause this Docker-specific autoloading problem!
Подробнее здесь: https://stackoverflow.com/questions/797 ... ound-error
Мобильная версия