I'm starting to work now with Laravel and realized that defining the routes directly to the controls where I can set the HTTP request type is more feasible for my application. Today I have something like this:
routes.php
Route::controller("usuario","UsuarioController");
UserController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UsuarioController extends Controller
{
public function __construct()
{
//$this->middleware("auth");
}
public function getAutenticar()
{
return view("Usuario/Autenticar");
}
}
My question is the following. Is there any way I can define a manual middleware within the control where only for 2 routes would I be free of the auth middleware?
I know that if I set these routes manually in the file routes.php
it works but by doing so I can not continue working using the HTTP request type definition inside my controller.
Can I in any way force my controller to accept 2 middlewares, 1 for "x" methods and another for the other methods?