I am new in Laravel. I read documentation and googling but I can't find answer for my problem.
Im trying to render a simple view test.blade.php (located at resources/views).
a) first try: in app/Http/routes.php I wrote
Route::get('/', function(){
return view('test');
});
It's working. Hurray! I see my simple site
b) second try: in app/Http/routes.php i wrote
Route::get('/', 'WelcomeController@index');
I have created a controller WelcomeController.php in app/Http/Controllers Inside controller I wrote:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class WelcomeController extends Controller
{
public function index()
{
return view('test');
}
}
And....this is not working, I see only blank page. Ok I was digging and digging and trying to understand what's the problem. I changed retun view('test') to return view()->make('test'); but this is not working too - it generates only blank page....
Then I simply changed retun to echo: echo view('test'); It is working like charm.
What am I doing wrong? all examples in the internet shows return view('..') not echo view('...') (which is ugly)...
Please help me :)
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1PdH5vn
via IFTTT
Aucun commentaire:
Enregistrer un commentaire