1

I'm learning Laravel and I tried to create a page where Laravel populates a table from DB, but I have an error (I did everythin what was in this PDF file (Page 67-69))

Error message:

FatalThrowableError in ListProductsController.php line 16: Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION)

ListProductsController.php

    <?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class ListProductsController extends Controller
{
    public function inventory(){
    $inventory = DB::select('select * from inventory');
    return view('inventory',['inventory'=>$inventory]);
}

My route:

Route::get('inventory','ListProductsController@inventory');

What goes wrong?

Feralheart
  • 1,881
  • 5
  • 28
  • 59

1 Answers1

3

You've forgot to add } at the end:

class ListProductsController extends Controller
{
    public function inventory() 
    {
        $inventory = DB::select('select * from inventory');
        return view('inventory',['inventory' => $inventory]);
    }
}
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279