P
P
Pavel2021-07-30 13:06:03
Laravel
Pavel, 2021-07-30 13:06:03

How to learn laravel 8 using the old lessons?

there are 100500 lessons on the Internet for laravel 7.4, but there are not enough lessons for 8 lessons yet, and there are a huge number of such changes that do not work in the new version, I literally “fall” at the first steps,

for example, I make a group of routes according to the lessons

Route::group(['prefix' => 'admin', 'namespace' => 'admin'], function () {
  Route::get('/','[email protected]')->name('admin.index');
});


I create a controller, but as it turned out, in version 8, the controllers are no longer there and I get an error
Target class [admin\MainController] does not exist.

there is a solution to write the code differently, but how can I do it if I still don’t really understand the essence of where to write the new code ...

I tried to use the old version of laravel but ran into even more errors, starting corny from the IDE helper for phpstorm works as it turned out only with version 8+, ending up with a bunch of dependencies in node_modules. And this despite the fact that I took a ready-made archive from the author’s lesson with a composer and pacage json files,

although it seemed to me that if the version is specified in the dependencies, everything should work as expected at any moment,

what would you advise or can the group of routes be rewritten for version 8?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2021-07-30
@mrusklon

Already in the seventh version, it was preferable to specify controllers as callable

use App\Http\Controllers\MainController;

Route::get('/', [MainController::class, 'index'])
  ->name('admin.index');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question