0

i had to ask this question here. i have seen so many other responses and none of them worked.. even after i editted the register function inside the app/providers/AppServiceProvider.php file - from a solution i got on laracasts.

public function register(){

    $this->app->bind('path.public_html', function(){
        return base_path(). '/public_html';
    });
    //
}

with this set, the hompage loaded successfully. but then after editting the welcome route to this ::

Route::get('/', function () {
   echo public_path();  //resolves to:: C:\xampp\htdocs\paprng\public
   exit;
   return view('welcome');

});

my public_path() function resolves to " C:\xampp\htdocs\paprng\public "..

please is there a string value of "public" somewhere in the laravel app. structure that requires editting to " public_html ", to avoid this error.

Thanks in advance.

Ande Caleb
  • 1,163
  • 1
  • 14
  • 35
  • Possible duplicate of [Laravel 5 change public\_path()](https://stackoverflow.com/questions/31758901/laravel-5-change-public-path) – Lloople Nov 17 '17 at 13:18

1 Answers1

0

Change the name of the public folder for whatever you want, and then add this code to index.php

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

EDIT:

On your bootstrap/app.php file, add this code after the declaration of $app variable:

$app->bind('path.public', function() {
    return realpath(__DIR__.'/../public_html');
});
Lloople
  • 1,827
  • 1
  • 17
  • 31