So I've been trying to learn laravel, but I've run into trouble pretty quickly and can't seem to find an answer to my problem. My routes.php file looks like
<?php
Route::get('/', 'PagesController@welcome');
Route::get('about', 'PagesController@about');
and PagesController.php looks like
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class PagesController extends Controller {
public function welcome(){
return view('welcome');
}
public function about() {
$name = 'My name';
return view('about')->with('name', $name);
}
}
Finally, about.blade.php looks like this:
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1>About Me: {{ $name }}</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</body>
</html>
When I try to load about about.blade.php nothing shows up in my web browser, and view page source reveals that there's no html there. But when I rename about.blade.php to about.php the file loads, except the {{ $name }}
part doesn't get rendered by blade like it should. The reason I'm especially confused is because welcome.blade.php, which is just the default welcome view for a new laravel project, loads just fine, as does the blade formatting stuff in it.