skip to Main Content

I’m working with Laravel 5.1
I have a template for a page that was previously working fine. I could hit my route and the page would be rendered as expected. At some point the page started just displaying the text contained in the blade template rather than rendering my page. To my knowledge nothing had changed in my routes file, controller or blade. Is there anything that is known to cause this to happen? I’ve tried updating permissions, using a different method to call the view and creating a new view file all together.

The route:

Route::group(['prefix' => '/admin'], function() {
Route::group(['prefix' => '/reactor-rules'], function() {
    Route::get('/visual-rules/{track_id?}', [
        'as' => 'broker_visual_reactor_rules',
        'uses' => 'ReactorRulesController@visualRules'
    ]);
});

});

ReactorRulesController@visualRules:

public function visualRules(IReactorTrackDAO $reactorTrackDAO, $id = 0)
{
    $export = new ReactorExport();
    
    $tracks = $export->getReactorTracks();
    if ($id == 0) {
        $eventsArray = [];
    }
    else {
        $eventsArray = $export->getArrayForTrack($id);
    }
    return $this->renderView('enterpriseBroker::reactor-rules.visual-rules', compact('eventsArray','tracks','reactorTrackDAO'));
}

My blade:

    @extends($layout)
{{ SEO::setPageTitle(trans('enterpriseBroker::reactorRules.title'), false) }}
@section('content')
    <br>
    <br>
    @if(empty($eventsArray))
        <p>Please select a track below to view/export rules.</p>
        @foreach($tracks as $track)
            <a href="{{url().'/admin/visual-rules/'.$track->id}}">{{$track->name}}</a><br>
        @endforeach
    @else
    @foreach($eventsArray as $track => $events)
        <h4>{{$track}}</h4>
        <a href="{{url().'/admin/visual-rules/'.$reactorTrackDAO->findByName($track)->id.'/download'}}" class="btn btn-primary" download>Export</a><br>
        @foreach($events as $id => $event)
        @if (count($event['rules']) > 0)
            <div id="{{$track.'-'.str_replace(' ','_',$event['name'])}}">
                <div class="col-lg-12">
                <hr/>
                    <div class="col-lg-2">
                        <h4>{{$event['name']}}</h4>
                    </div>
                    <div class="col-lg-10  border border-primary">
                        @foreach($event['rules'] as $ruleId => $rule)
                            <h5>{{$rule['name']}}</h5>
                            <div class="col-lg-6">
                                <h6>Conditions to be met:</h6>
                                @foreach($rule['conditions'] as $condition)
                                    <p>{{$condition}}</p>
                                @endforeach
                            </div>
                            <div class="col-lg-6">
                                <h6>Actions to run:</h6>
                                @foreach($rule['actions'] as $action)
                                    <p>{!!$action!!}</p>
                                @endforeach
                            </div>
                        @endforeach
                    </div>
                </div>
            </div>
        @endif
        @endforeach
    @endforeach
    @endif
@endsection
@section('scripts')
@endsection

This is how it originally appeared:
Original Screenshot

This is how it currently appears:
Current Screenshot

2

Answers


  1. Chosen as BEST ANSWER

    I resolved the issue by creating a new blade file, pasting the contents of the old one in and pointing my controller to the new view. I'm not sure how this resolved the issue.


  2. It seems to be error with $layout

    Try to test it using a hard coded value as below:

    @extends('layouts.app')
    

    and run below command

    php artisan view:clear
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search