Apparently one can only use a ternary statement when implementing conditional logic with the @extends
blade directive, ex)
@extends($test ? 'layouts.test' : 'layouts.default')
If one needs to pass a variable into the extended layout, such as with the following syntax:
@extends('layouts.test', ['variable' => true])
Is there any way to incorporate the variable passing syntax into the ternary statement?
Edit:
To add clarity, the logic I'm trying to accomplish with the ternary @extends
call is as follows:
@if($test)
@extends('layouts.test', ['variable' => true])
@else
@extends('layouts.default')
@endif
Hope it will help you.
@extends($test ? ('layouts.test' ? ['variable' => true] : ['variable' => false]) : ('layouts.default' ? ['variable' => false] : ['variable' => true]))