Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel blade conditional class

@php
    $isActive = false;
    $hasError = true;
@endphp
 
<span @class([
    'p-4',
    'font-bold' => $isActive,
    'text-gray-500' => ! $isActive,
    'bg-red' => $hasError,
])></span>
 
<span class="p-4 text-gray-500 bg-red"></span>
Comment

PREVIOUS NEXT
Code Example
Php :: custom error page htaccess 
Php :: create migration with model laravel 
Php :: special characters in php 
Php :: Get wordpress posts by category name..! 
Php :: route group in laravel 
Php :: laravel blade check if request url matches 
Php :: how to write tests for php 
Php :: laravel APP_ENV config 
Php :: laravel collection max 
Php :: laravel mail send 
Php :: cakephp 4 change layout view in a method 
Php :: config file php 
Php :: how make a variable global php 
Php :: symfony add field to entity 
Php :: laravel where in array 
Php :: pdo select 
Php :: select option edit in laravel 
Php :: php unique associative nested array by value 
Php :: if function not exists php 
Php :: today date to ago for the date in php 
Php :: random string value laravel 
Php :: return with success message laravel 
Php :: ci constructor 
Php :: codeigniter 3 or where in 
Php :: woocommerce product hooks 
Php :: Add Text Before the Product Title 
Php :: get the current datetime in php when button is clicked 
Php :: validate columns laravel excel 
Php :: wordpress plugin functions exist 
Php :: update checkbox value in laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =