Sahidul Islam
Sahidul Islam

Reputation: 489

Laravel view is not working

i am trying to learn laravel. I am facing problem with view. while i run this following code:

Route::get('/', function(){
    return 'welcome';
});

It works fine. But while i tried to use view

Route::get('/', function(){
    return view('welcome');
});

i get nothing but a blank page. (a welcome.balde.php page is exist in resource/views directory)

I also getting problem during routing. a code like this

Route::get('home', 'HomeController@index');

i can't access localhost/laravel/public/home directory it gives me an error that there is no directory or file not found. Instead of this localhost/laravel/public/index.php/home url works. Don't know what's the problem. I am using php 5.4 and mysql 5.5

Upvotes: 5

Views: 6940

Answers (2)

Sahidul Islam
Sahidul Islam

Reputation: 489

I am using linux OS, that is why having problem with permission. After giving proper permission (apache server) to my project folder, view problem is fixed.

Upvotes: 4

Thomas Shelby
Thomas Shelby

Reputation: 1370

view() function probably doesn't exist. Try this,

Route::get('/', function(){
    return View::make('welcome');
});

If this doesn't help(Check your log, stored in app/storage/logs)

Your application is in debug mode? You can check this in /app/config/app.php file.

Upvotes: 1

Related Questions