Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do Middleware implements no interface?

In Laravel < 5.2, middlewares implemented an interface described by this contract: Illuminate\Contracts\Routing\Middleware.

Now, a Middleware created with artisan does not implement anything anymore. And the contract was removed with no explaination (unless I mistake).

Is there a reason?

like image 568
rap-2-h Avatar asked Oct 30 '22 03:10

rap-2-h


1 Answers

As per laravel 5.2 upgrade guide at official documentation under Deprecations section:

The Illuminate\Contracts\Routing\Middleware contract has been deprecated. No contract is required on your middleware. In addition, the TerminableMiddleware contract has also been deprecated. Instead of implementing the interface, simply define a terminate method on your middleware.

like image 190
Chetan Ameta Avatar answered Nov 15 '22 06:11

Chetan Ameta