if statement in laravel blade code example
Example 1: laravel if syntax
@if (foo)
@elseif (bar)
@else
@endif
Example 2: use if in laravel blade
@if($user->status =='active')
<td>{{ $user->name }}</td>
@else
<td> Guest </td>
@endif
Example 3: if else statement in laravel blade
@if ($dummy == 1) we have 1 record@elseif ($dummy ==10) we have 10 record@else No record found.@endif
Example 4: laravel blade section keep template
<!-- Stored in resources/views/child.blade.php -->
@extends('layouts.app')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<p>This is my body content.</p>
@endsection