Reputation: 167
Started working through a very basic Laravel 5 tuturial, after installing a thresh laravel installation via composer, and experienced the following problem. Having created an about view 'resources/views/about.blade.php', I only get a blank page displayed.
The strange thing is, having played around with the welcome page, to try and isolate the problem, it turns out that I can only view the welcome page if its name is welcome.
routes.php code:
Route::get('about', 'PagesController@about');
PagesController.php code:
<?php
namespace App\Http\Controllers;
class PagesController extends Controller {
public function about() {
return view('welcome');
}
}
This displays the 'resources/views/welcome.blade.php' file prefectly. However, if I rename it to anything else eg. 'resources/views/test.blade.php', and change the return view in the controller accordingly:
return view('test');
I just get a blank page. What's the problem?
Upvotes: 0
Views: 728
Reputation: 167
The problem turns out to be the URL. Following the Laracast tutorials (Laravel 5 Fundamentals), I started the server using the following command:
php -S localhost:8888 -t ~/Desktop/html/learning-laravel-5/public
This results in the following Laravel project's root address: http://localhost:8888
Consequently, http://localhost:8888/about equates to the about page. However, I ended up using the following address:
localhost/learning-laravel-5/public/about
This results in a blank page if I haven't already viewed the page via http://localhost:8888/about
Upvotes: 0
Reputation: 11310
I guess your problems should be this,
Problem :
You would not configured your .htaccess
to point your application directly
What should you do
You should make your call to the application absolutely
How
Do you call like this
http://yourapplication.com/public/index.php/about
If you want to access it like
http://yourapplication.com/about
then you should configure .htaccess
to make it done (Let me know if you need this)
Note :
Make sure that you enable error_reporting in your server
Make sure that you output something in your blade
Upvotes: 0