I'm just starting using laravel and there's a problem when i'm using models.
I already make a dummy data inside model in profilesModel.php
private static $pData = [
"pNamaLengkap" => "Anro Anderson",
"pJobDescription" => "Full Stack Developer",
"pUnitKerja" => "Talent Management",
"pDirektorat" => "Human Resource"
];
public static function all()
{
return self::$pData;
}
I already tried calling the model using web.php
use App\Models\profilesModel;
Route::get('/profiles', function () {
return view('profiles', [
"profiles" => profilesModel::all()
]);
});
and the data is recognize and become an array, here's the prove
But from the blade.php didn't get the data and become a Undefined variable
When I'm using this code in web.php instead of the model it worked perfectly fine
Route::get('/profiles', function () {
return view('profiles', [
"pNamaLengkap" => "Anro Anderson",
"pJobDescription" => "Full Stack Developer",
"pUnitKerja" => "Talent Management",
"pDirektorat" => "Human Resource"
]);
});
But I'm stil wanted to use the model, please help Thank you