Have a look at all helpers ;)
base url
Hello,
I want to add base url in laravel, how to do so?
value="{{ $image->img_name }}"
Add base url to the value
Is URL::asset the same like public_html?
<link rel="stylesheet" href="{{ URL::asset('themes/style/add.css') }}" />
public_html is your server directory, helper will work if your domain points well on this folder.
What this mean:
URL::asset('themes/style/add.css')
Which exact folder does it refer to?
@@davy_yg please try this process
if you want to change your base url then open your .ENV file and change your code
APP_URL=http://localhost
to
APP_URL= ? which one you want your base url link // example APP_URL = http://towhid.localhost
for this base url u must be use document root process follow if you want xamp server then follow this code
https://www.cloudways.com/blog/configure-virtual-host-on-windows-10-for-wordpress/
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/laravel/laravel-one"
ServerName towhid.localhost
<Directory "c:/xampp/htdocs/laravel/laravel-one">
</Directory>
</VirtualHost>
#
127.0.0.1 localhost
::1 localhost
127.0.0.1 towhid.localhost
after this procedure complete you must be restert your server local then you can get your base url this syntax
{{url('/')}} http://towhid.localhost
$url = url('/') // http://towhid.localhost
@towhid That APP_URL is mostly for the console, tests and emails.
@davy_yg Are you serious? The documentation is right here... https://laravel.com/docs/5.8/urls
You can see the value if outputs by looking at the page source or doing a simple dd. I mean come on, this is just simple debugging and reading documentation...
Start looking at the documentation for once Davy. You've been asking bullshit questions for nearly a year and a half now, on everything that is in the documentation, or on the first page in Google. Are you actually going to learn how to code at some point, or are you just gonna milk Laracasts for the answers?
The point of this forum is to help people, yes, but not to help people who can't even consult the documentation, and ask questions multiple times per week, to which the answers can be found in seconds.
{{ asset('images/'.$image->img_name) }}
this refer to public/images/ folder and image in it .
I use asset helper.
@JLRDW - i think this is use only for
assests call like css, image and js
asset('')
action time / href / or url call
url('')
naming time only
route('')
<img src="{{ asset('upload/imgdogs') . '/' . $row->dogpic }}" alt="" class="image">
Works perfect.
why you want to use base url in your value ??
if you really want to use your base url in your value ... just use
{{url('/').$image->img_name}}
Please or to participate in this conversation.