I have the following including of templade blade in main layout:
@if (Auth()->user()->verified == "0")
@include('common.verify-error')
@endif
So, how to display @include('common.verify-error')
on the all URL excluding /test
, /out
Should I do this in controller or simple if condition in template?
To start, there's probably a few different approaches to this. Personally, I'd do something along the lines of a middleware class...or inject a class in the view, etc.
However, he's another solution that may suit your needs better.
EDIT: Made a change. I'm assuming you use named routes (and should, in the event you want to change urls, etc. You won't have to deal with changing all these if statements for example).
@if (Auth()->user()->verified == "0" && !Route::is('test') && !Route::is('out'))
@include('common.verify-error')
@endif
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments