after migrating my code to Laravel 10, I had errors

after migrating to 10 i have error

after migrating to 10 i have error

ErrorException: Undefined property: YourModel::$dates
Error: Call to undefined method App\Jobs\YourJob::dispatchNow()
BadMethodCallException: Call to undefined method Illuminate\Routing\Route::home()

>Solution :

For This Error: ErrorException: Undefined property: YourModel::$dates

protected $dates = ['created_at', 'updated_at'];
in the model is deprecated change to

protected $casts = [ 'created_at' => 'datetime', ....];

For This Error: BadMethodCallException: Call to undefined method Illuminate\Routing\Route::home()

Route::home method has been deprecated use Route::get('/', '');

For This Error: Call to undefined method App\Jobs\YourJob::dispatchNow()

$job->dispatchNow(); is now $job->dispatchSync();

Do Kindly upgrade document for Laravel click here

Leave a Reply