Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

eagle_arg's avatar

Composer View problems with Digital Ocean

Hi, Yesterday I deployed my first application to Digital Ocean by cloudways... So far I'm having a few issues. The first one: My navbar it is completing itself with a composer view (I pass to the view the options according to the user logged). In my localhost is working right... But in Digital Ocean is not completing itself. This is my ViewComposerServicesProvider:

<?php namespace App\Providers;

use App\File_Entry;
use App\Options;
use App\Profile_Option;
use App\User;
use Auth;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\ServiceProvider;

class ViewComposerServiceProvider extends ServiceProvider {

    /**
     * Se completa el menu nav
     *
     * @return void
     */
    public function boot()
    {
        view()->composer('partials.nav', function($view)
        {
            // si el usuario esta logueado busca el profile para buscar las opciones habilitadas
            // y dibujarlas, caso contrario muestra solo ingresar
            if (! Auth::guest())
            {
                $usuario = User::obtenerUsuarioLogueado();
            }
            else
            {
                $user_profile = null;
                $usuario = null;
            }

            $view->with('Options',
                        Options::where('active', '=', true)
                                ->WhereHas('OptionProfile', function($query) use ($usuario){
                                    $query->where('profile_id', '=', $usuario['profile_id']);
                                })
                                ->Orderby('order')
                                ->get()
                        );
        });
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {

    }

}

The second problem that I Have is the performance... Is pretty bad, in my localhost every page is loaded in 120ms, but with Digital Ocean is taking 4 sec. I ran php artisan route:cache, php artisan config:cache, php artisan optimize --force.

But is not working well.

So if anyone can help i will apreciate it.

Thanks!!

0 likes
1 reply
eagle_arg's avatar
eagle_arg
OP
Best Answer
Level 3

I found the problem... The problem was in my view, I was trying to filter a value with out ''

Please or to participate in this conversation.