Friday, March 17, 2017

laravel url is messed up

So, i basically have a view composer that fetches the user avatar and then passes it to the view. the user's avatar is http://placehold.it/150x150. However when laravel fetches it the url gets messed up instead it becomes ["http://placehold.it/150x150"]. is this a problem with blade? idk if this will be any help but here is the code:

     view()->composer('layouts.navbar',function($view)
      {
        $view->with('avatar', \App\User::getAvatar());
      });

    public static function getAvatar()
    {
 return User::Where('username', '=', Session::get('username'))->pluck('avatar');
    }

here is how the url looks like in chrome enter image description here

could this be a problem with laravel blade? because im doing img src=



via flex_

Advertisement