Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel base path

Tags:

php

laravel

Im using URL::base(); and I get this URL:

http://www.kp.com.mx/sis_colgate/public

but what I need is this complete path:

/home/belendez/public_html/sis_colgate/public

Does anybody knows how can I get that path? Thanks

like image 339
ebelendez Avatar asked Jan 31 '13 17:01

ebelendez


People also ask

Which is the root folder in Laravel?

The Root Directory Structure of LaravelThe app directory holds the base code for your Laravel application. The bootstrap directory contains all the bootstrapping scripts used for your application. The config directory holds all your project configuration files (. config).

What is path in Laravel?

1 - app_path() - The app_path function returns the fully qualified path to your application's app directory. 2 - base_path() - The base_path function returns the fully qualified path to your application's root directory.

How do I change the root path in Laravel?

./config/filesystems.Modify the section 'public' to change the 'root' value 'app/public' to your desired location, for example, app/public_html ( app is an alias of your root folder).


2 Answers

Laravel has helpers for paths:

base_path();    // '/var/www/mysite'
app_path();     // '/var/www/mysite/app'
storage_path(); // '/var/www/mysite/storage'
like image 59
yesnik Avatar answered Oct 13 '22 17:10

yesnik


What you want to use is the path helper.

The URL helper is for generating HTTP URLs.

Try the path('public') function in Laravel 3,

or the public_path() function in Laravel 4.

Edit: Updated with answer for Laravel 4, thanks Erin

like image 29
Deinumite Avatar answered Oct 13 '22 19:10

Deinumite