2
votes

I am learning Laravel framework and I have created simple project.

This is my code:

web.php

Route::get('/', function () {
return view('welcome');
});

Route::get('/people', ['uses' => 'PeopleController@index']);

PeopleController.php

class PeopleController extends Controller
{
public function index()
{
    $users = [

        '0' =>[
            'first' => 'Alex',
            'last' => 'Shifu',
            'location' => 'Gotham'
        ]
    ];

    return view('people.index' , compact('people'));
}
}

index.blade.php

@foreach($people as $peep)
    <li>{!! $peep['first'] !!}</li>
@endforeach

These are the errors I am facing:

in RouteCollection.php line 161 at RouteCollection->match(object(Request)) in Router.php line 766 at Router->findRoute(object(Request)) in Router.php line 621 at Router->dispatchToRoute(object(Request)) in Router.php line 607 at Router->dispatch(object(Request)) in Kernel.php line 268 at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php line 46 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 104 at Pipeline->then(object(Closure)) in Kernel.php line 150 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117 at Kernel->handle(object(Request)) in index.php line 54 at require_once('C:\wamp64\www\MyApp\public\index.php') in server.php line 21

1

1 Answers

0
votes

The only problem I see is that you have to change $users to $people in your index() method.

Other than that, everything looks fine.