Im trying to make a dashboard profile but when i try to /dashboard on the laravel server it doesn’t appear.
this is the dashboard code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Style Sync DashBoard Page</title>
<link rel="stylesheet" href="StyleDashboard.css">
</head>
<body>
<div id="dashboard" class="dashboard">
@foreach($people as $person)
<div class="card">
<img src="{{ $person->image_url }}" alt="{{ $person->name }}'s picture">
<div class="card-body">
<h2>{{ $person->name }}</h2>
<p>Section: {{ $person->section }}</p>
<p>Hobby: {{ $person->hobby }}</p>
</div>
</div>
@endforeach
</div>
</body>
</html>
this is the dashboard controller:
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppModelsPerson;
class DashboardController extends Controller
{
public function index()
{
$people = Person::all();
return view('dashboard', compact('people'));
}
}
this is the route in the web.php:
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
this is on the models: Person.php
<?php
namespace AppModels;
use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;
class Person extends Model
{
use HasFactory;
protected $fillable = ['name', 'section', 'hobby', 'image_url'];
}
then this is on the migrations:
<?php
use IlluminateDatabaseMigrationsMigration;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;
class CreatePeopleTable extends Migration
{
public function up()
{
Schema::create('people', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('section');
$table->string('hobby');
$table->string('image_url');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('people');
}
}
Im trying to test if the dashboard is working but its not appearing. its just white.