Dika Suryana Putra
Dika Suryana Putra

Reputation: 13

syntax error, unexpected 'Route' (T_STRING)

Please Help Me, The Error Says syntax error, unexpected 'Route' (T_STRING), what's wrong with my script ?

Script in Controller:

public function tambah(Request $request){
      $tambah = new kategori;
      $tambah->nama_kategori = $request->nama_kategori;
      $tambah->save();
  }

Script in Route:

localhost:8000/kategori
Route::get('/kategori', function()
{
    return view('kategori');
});
Route::post('/tambahdata', 'KategoriController@tambah')->name('tambahdata');

Upvotes: 0

Views: 1538

Answers (1)

Abolfazl Mohajeri
Abolfazl Mohajeri

Reputation: 1987

you should remove or comment:

localhost:8000/kategori

so the route file look like:

Route::get('/kategori', function()
{
    return view('kategori');
});
Route::post('/tambahdata', 'KategoriController@tambah')->name('tambahdata');

Upvotes: 1

Related Questions