bnynn
bnynn

Reputation: 501

Laravel Blade: Try if imported php file exists

How would you do this using blade's @import method? I've tried:

@if (@include('/path/to/phpfile'))
    @include('/path/to/phpfile')
@else
    <h2>Oops! It doesn't look like this page exists!</h2>
@endif

also tried with file_exists(), no dice :(

Upvotes: 1

Views: 1976

Answers (1)

The Alpha
The Alpha

Reputation: 146201

You may try this:

@if(View::exists('viewname'))
    @include('viewname')
@endif

Upvotes: 7

Related Questions