Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 845
Sahidul Islam Avatar asked Feb 13 '15 17:02

Sahidul Islam


2 Answers

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.

like image 185
Sahidul Islam Avatar answered Oct 13 '22 03:10

Sahidul Islam


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.

like image 1
Thomas Shelby Avatar answered Oct 13 '22 03:10

Thomas Shelby