Search
 
SCRIPT & CODE EXAMPLE
 

PHP

write if and else in one line laravel

//in blade:
{{ ($data->position == 1) ? 'active' : 'disable'}}

//in Controller
$result = ($data->status == 1) ? 'active' : 'disable'
Comment

PREVIOUS NEXT
Code Example
Php :: index.php wordpress 
Php :: get am/pm from date in php 
Php :: convert one time zone datetime value to another using php 
Php :: curl follow redirect php 
Php :: ucfirst() php 
Php :: php generate random string fixed length 
Php :: laravel migration data types 
Php :: laravel enum migration example 
Php :: php check if file is video 
Php :: how to install bootstrap in laravel 8 
Php :: php split string along spaces 
Php :: laravel get random number of data from database 
Php :: mysql replace a character in a string 
Php :: get template name wordpress 
Php :: check image is available on server php 
Php :: hide .php from url .htaccess 
Php :: what is app_env in laravel 
Php :: php time limit 
Php :: php exception message 
Php :: year shortcode wordpress 
Php :: Where is the php.ini file on a Linux/CentOS 
Php :: php get day from date 
Php :: import class route laravel 
Php :: laravel mix purge css 
Php :: codeigniter get user ip 
Php :: laravel validate integer between 
Php :: laravel collection toArray 
Php :: laravel order by raw 
Php :: jdate get one day before php 
Php :: carbon parse sunday 30 days ago 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =