I am having difficulty extending to different layout file according to the if else condition:
@if($subdomain_alias === "blk")
@extends("layouts.frontend-new")
@section('title')
Home
@endsection
@section('content')
{{-- Some Content --}}
@endsection
@else
@extends('layouts.frontend')
@section('title')
Home
@endsection
@section('content')
{{-- Some Content --}}
@endsection
@endif
But the problem is both the layout is included and I can see everything twice.
I tried using @include but the view contents are not loaded in that.
The header appears twice. How can I solve that?
you need to use a ternary operator for selecting between different master layout in first line of your blade file:
@extends(($subdomain_alias === "blk" ? "layouts.frontend-new" : "layouts.frontend"))
@section('title')
Home
@endsection
@section('content')
{{-- Some Content --}}
@endsection