Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify a different public path

Tags:

laravel-5

My Laravel app works in the private folder and I need to tell Laravel that the public path is different. Today I have upgraded a Laravel app from 4.2 to 5.0 and I can't find where we specify the public path since the paths.php file doesn't exist anymore in Laravel 5.0.

In laravel 4.2 we had the /bootstrap/paths.php file:

/*
|--------------------------------------------------------------------------
| Public Path
|--------------------------------------------------------------------------
|
| The public path contains the assets for your web application, such as
| your JavaScript and CSS files, and also contains the primary entry
| point for web requests into these applications from the outside.
|
*/

'public' => __DIR__.'/../../../public_html',

I'm not used with the Laravel 5.0 folders structure yet, any help would be greatly appreciated.

like image 479
egdavid Avatar asked Feb 10 '15 14:02

egdavid


People also ask

What is the publicpath configuration used for?

The publicPath configuration option can be quite useful in a variety of scenarios. It allows you to specify the base path for all the assets within your application. There are a few use cases in real applications where this feature becomes especially neat.

What is the use of public path in Java?

Public Path The publicPath configuration option can be quite useful in a variety of scenarios. It allows you to specify the base path for all the assets within your application.

What is publicpath in Salesforce?

Public Path. The publicPath configuration option can be quite useful in a variety of scenarios. It allows you to specify the base path for all the assets within your application.

What is publicpath in Webpack?

publicPath specifies the virtual directory in web server from where bundled file, app.js is going to get served up from. Keep in mind, the word server when using publicPath can be either webpack-dev-server or express server or other server that you can use with webpack.


Video Answer


1 Answers

What worked for me flawlessly was adding to public/index.php the following three lines:

$app->bind('path.public', function() {
    return __DIR__;
});

This was answered at Laracast.

like image 157
Rubens Mariuzzo Avatar answered Nov 09 '22 17:11

Rubens Mariuzzo