mardi 18 octobre 2016

php artisan serve parse error

i know this question already exist, but i could not solve via the other responses, so the first time i runed php artisan serve it worked, i changed the routes so the logic go to the controllers and they can call the views, so i have this at the moment.

Routes

Route::get('/',PagesController@home);
Route::get('about',PagesController@about);

PagesController

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

class PagesController extends Controller
{
   public function home(){
       $People = array("Joao","Miguel","Carlos");
       return view('welcome',compact('People'));
   }

   public function about(){
       return view ("pages.about");
   }
}

when i changed the routes i turned off the connection via local server on my cmd, after that i tryed again the command php artisan serve and now i get a parse error like this:

[Symfony\Component\Debug\Exception\FatalThrowableError] Parse error: syntax error, unexpected '@', expecting ',' or ')'

routes before

Route::get('/', function () {
$People = array("Joao","Miguel","Carlos");
return view('welcome',compact('People'));
});

Route::get('/about',function(){
    return view ("pages.about");
});

Have no idea why this happens :S if someone can give me a tipe i appreciate :)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire