I am new to the laravel framework. I tried to pass data from the database to my view but it gives me the following error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.aanvragens' doesn't exist (SQL: select * from
aanvragens
).
Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Aanvragen;
use Carbon\Carbon;
class aanvragenController extends Controller
{
public function index() {
$aanvragen = Aanvragen::all();
return view('aanvragen.index', compact('aanvragen'));
}
}
Route
Route::get('/overzicht', 'aanvragenController@index')->name('aanvragen.index');
Model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Aanvragen extends Model
{
}
I know my database connection is working as I can migrate my migrations (the default ones). What is strange to me is that I can't recall I typed aanvragens
somewhere. Not in my controller, view, model etc. My database table name is aanvragen
. Is there someone who can help me? Maybe I forgot to include something or made a typo..
via Gijsberts