Support the ongoing development of Laravel.io →
Views Blade Forms

Hello all,

I'm using blade and I was wondering how Can I insert a propriety "READONLY" in case of the URL is equal user.show FOR EXAMPLE:

IF \Request::route()->getName() == user.show

OR

(\Request::route()->getName() == "user.show" ? "'readonly'=> ' '," : '')
<!-- ------------- -->

<div class="input-group col-md-6">
{!!Form::text('name', $user->name, 
    array(
    'class'=>'form-control', 
    'placeholder'=>'Name of User',
    'readonly'=> ' ' // SET THIS VALUE AUTOMATICALLY
))!!}
</div> 
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.