Laravel Blade If Multiple Conditions Example
Now, let's see example of laravel blade if multiple conditions. i explained simply step by step multiple if condition in laravel blade. Here you will learn if two conditions laravel. let’s discuss about if with and and or in laravel blade. Alright, let’s dive into the steps.
you can write multiple conditions in if statement with laravel 6, laravel 7, laravel 8 and laravel 9.
let's see bellow simple example:
Blade File Code:
@if($isAdmin == 1 && $active == 1)
Admin User
@endif
Controller File Code:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class AjaxController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function index()
{
$isAdmin = 1;
$active = 1;
return view('ajaxRequest', compact('isAdmin', 'active'));
}
}
Output:
Admin User
I hope it can help you...

Hardik Savani
I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Laravel nl2br Blade Directive Example
- How to Create Custom Blade Directive in Laravel?
- Laravel - How to check if isset variable in Blade?
- How to Write PHP Code in Laravel Blade?
- Laravel - How to Check If Array is Empty in Blade?
- Laravel - How to get .env variable in blade or controller?
- Laravel 5.5 New Feature - BladeIf Directive Example
- How to create blade view file using command line in Laravel?
- Laravel ajax render view with data example
- How to check if View Exists or not in Laravel?