mercredi 22 juin 2016

Undefined variable in view on server

My Laravel webpage works perfectly fine locally, but when I upload it to my server it breaks. It was working fine until the last update I made, where I added more or less the entire webpage.

There are some version mismatches between the two installations:

Local: Arch Linux
Server: Ubuntu 14.04
Local: php 5.6.16
Server: php 5.5.9

Here is a screenshot of the error I am currently facing, but there are more. If I comment this line another error shows: Error The failing view is a bar which is shown on all pages except the login page. "layouts/topbar.blade.php":

<div class="container topbar-container" style="text-align:right;">
    <a class="btn btn-primary active" role="button" href= {{URL::to('/dashboard')}}>Dashboard</a>
    @if ($role == "admin")
        <a class="btn btn-primary active" role="button" href= {{URL::to('/dashboard/admin_settings')}}>Admin Settings</a>
    @endif
    <a class="btn btn-primary active" role="button" href= {{URL::to('/dashboard/settings')}}>Settings</a>
    <a class="btn btn-primary active" role="button" href="{{ URL::to('/auth/logout') }}">Sign Out</a>
</div>

Using this View Composer "ViewComposers/UserComposer.php":

<?php

namespace AppHttpViewComposers;

use IlluminateContractsViewView;
use Auth;

class UserComposer
{
    /**
     * Create a new profile composer.
     *
     * @param  UserRepository  $users
     * @return void
     */
    public function __construct()
    {
    }

    /**
     * Bind data to the view.
     *
     * @param  View  $view
     * @return void
     */
    public function compose(View $view)
    {
        $view->with('role', Auth::user()->role);
    }
}

I am happy to provide more information if necessary, but I don't know what is relevant to be honest.

Aucun commentaire:

Enregistrer un commentaire