R
R
Ruslan Absalyamov2019-04-11 09:50:41
Laravel
Ruslan Absalyamov, 2019-04-11 09:50:41

How to check Request::is on a page where there is an id?

How to check Request::is if the page has an id. Let's say company/id

@if(Request::is('company', 'company/..')) active @else disabled @endif

How should I build the check for Reqyest::is. Examination'company/[0-9]'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
php_raper, 2019-04-11
@rusline18

An example from the documentation
https://laravel.com/docs/5.8/requests
Template validation :
if ($request->is('company/*')) {
//
}
Where exactly do you want to validate? Blade file?
You can organize a bool variable that returns true / false depending on the route, and define it at the controller level - this is an option for solving your problem.
I think you have 2 routes that work with different methods of the same controller.
Accordingly, define a variable in each method ,.
Describe your task in more detail, in which file, which routes you use.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question