Answer the question
In order to leave comments, you need to log in
What is the best way to organize routes?
Hello, please tell me the best way to do it.
I am making a website where the user has a personal account, he can register and enter it.
I make my personal account on vue-route.
And now the user from his personal account must send various requests, that is, for example, get his profile data, or his messages.
Is it better to make an API then? But wouldn't it be too confusing? And I still need to think about the fact that the user could not receive messages, for example, from someone else's user, by sending a request with a non-own ID.
Yes, at the moment web.php looks like this:
Route::get('/', [PageController::class, 'index'])->name('home');
require __DIR__.'/auth.php'; // Тут просто авторизация
require __DIR__.'/account.php'; // Тут маршрут для личного кабинета
Answer the question
In order to leave comments, you need to log in
You have some too clumsy mixture of laravel and vuejs.
Either make this site as 2 separate (api and frontend), or all in one place. The second option I think is not very successful. It is better to divide all the same into 2 domains.
Regarding routes
For starters, you can place them in the routes folder, and connect them to the RouteServiceProvider
Route::middleware('который нужен')
->namespace($this->namespace)
->group(base_path('routes/ваш путь до файла'));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question