Randy_Johnson
4 months ago
398
7
General

Isset @extend this view, else @extend this view

Posted 4 months ago by Randy_Johnson

I am trying to use one page for two users, but the two users have separate layouts. I thought it would be as simple as this.

@if(isset($datas['carts']))
   @extends('layouts.app') @section('title', 'Checkout') @section('content')
@endif

@if(isset($datas['product']))
   @extends('layouts.coteheath') @section('title', 'Checkout') @section('content')
@endif

The outcome is that the first layout.coteheath, since this var is filled, is produced, with the page in question, and then the second layout.app is produced, even though the var is not filled.

So the final outcome is that I have a double page displayed.

+--------------------+
|  layout.coteheath  |
+--------------------+
|                    |
|  checkout page     |
|                    |
|                    |
|                    |
+--------------------+
|  layout.app        |
+--------------------+
|                    |
|  checkout page     |
|                    |
|                    |
|                    |
|                    |
+--------------------+

Please sign in or create an account to participate in this conversation.