Simple question, but the answer seems quite hard to come by. In Codeigniter, I could load the url helper and then simply do
echo base_url();
<
By the way, if your route has a name like:
Route::match(['get', 'post'], 'specialWay/edit', 'SpecialwayController@edit')->name('admin.spway.edit');
You can use the route()
function like this:
<form method="post" action="{{route('admin.spway.edit')}}" class="form form-horizontal" id="form-spway-edit">
Other useful functions:
$uri = $request->path();
$url = $request->url();
$url = $request->fullUrl();
asset()
app_path();
// ...
https://github.com/laravel/framework/blob/5.4/src/Illuminate/Foundation/helpers.php
Laravel < 5.2
echo url();
Laravel >= 5.2
echo url('/');
Hope this helps you
Check this -
<a href="{{url('/abc/xyz')}}">Go</a>
This is working for me and I hope it will work for you.
I also used the base_path()
function and it worked for me.
To get it to work with non-pretty URLs I had to do:
asset('/');
I used this and it worked for me in Laravel 5.3.18:
<?php echo URL::to('resources/assets/css/yourcssfile.css') ?>
IMPORTANT NOTE: This will only work when you have already removed "public" from your URL. To do this, you may check out this helpful tutorial.