Jump to content
Fórum Script Brasil
  • 0

Erro ao compilar PHP ARTISAN SERVE (LARAVEL) no cmd


Question

Boa noite, estou aprendendo laravel no php e estou seguindo um pdf. Porém deu um erro (Non-static method Illuminate\Routing\Route::middleware() should not be called statically) na hora que eu vou compilar (php artisan serve) no cmd e não aparece na URL o LARAVEL. O erro consta na minha api na linha 6, no caso Route::middleware('auth::api')->get('/user', function (Request $request) {
return $request->user();
}); se alguém puder me ajudar
Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Tenta assim:

Route::get('/user', function (Request $request) {
    return $request->user();
})->middleware('auth::api'); 

OU

Route::group(['middleware' =>'auth::api'], function () {
    Route::get('/user', function (Request $request) {
        return $request->user();
    });
});

Link to post
Share on other sites
  • 0
1 hora atrás, Leonardo Persan disse:

Roda um php artisan --version no terminal

Qual erro?

Route cannot be resolved to a type - Esse é o erro quando tira a linha 2.

Eu fui compilar(php artisan --version) no terminal e me apareceu a mensagem (In Macroable.php line 78: Method Illuminate\Routing\Route::group does not exist.).

Sem título.jpg

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148674
    • Total Posts
      644490
×
×
  • Create New...