I add the function "prep_url" from codeigniter to my laravel project like here:
Laravel add http to urls
If I do it in my Controller like this:
$website = example.com;
$url = prep_url($website);
and then in my view I can do it like this:
{{$url}}
it shows me this: http://example.com
so everything works :)
but I have a problem
I have the table users and there all users have a website
in my controller I do it like this:
$user = DB::table('users')->get();
return view('user/einzelansicht' ['user' => $user] );
and in my view I can show my user with
{{$user[1]->name}}
{{$user[1]->website}}
how can I use prep_url here?
because I already did this in my view:
{{prep_url($user[1]->website);}}
but it tells me semicolons are not allowed and without the semicolon it does not work
then I tried in my controller this:
$website = $user->website;
$url = prep_url($website);
but this doesn't work too
so how can I do this?