5

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

Sahidul Islam
  • 489
  • 5
  • 18

2 Answers2

4

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.

Sahidul Islam
  • 489
  • 5
  • 18
1

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.

Thomas Shelby
  • 1,340
  • 3
  • 20
  • 39