Randy_Johnson
4 months ago
345
2
General

Can you REDIRECT in BLADE?

Posted 4 months ago by Randy_Johnson

I have some code which is working fine, but on one exit I don't want to have the same layout template, but I need it to change, the only way I can imagine this happening is that I am able to redirect to a url.

@extends('layouts.app')
 
@section('content')

@if(auth()->check())
    @if(auth()->user()->access_level == 0)
        @include('admin.home')
    @elseif(auth()->user()->access_level == 1)
        @include('welcome')
    @elseif(auth()->user()->access_level == 2)
        @include('user.home')
    @endif
@else 
    <div class="container mt-5">
        <div class="alert alert-danger" role="alert">
            Your session has timed out - <a href="login">log back in</a>.
        </div>
    </div>
@endif

@endsection

The user with access level 1 should have another navigation bar. I have also come to realize that the way I have created my users system is not good at all when it comes to changing or creating more users. Please if anyone knows where I can find a tutorial or article which can teach me how this is done properly I would be forever thankful.

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