Reputation: 1
Using the code below resulting in an empty array
$data = M_Obat::all();
While using the code below resulting in an array containing 2 data
$data = DB::table('master.ruangan')->get();
Attached images: [1]: https://i.sstatic.net/KSc9Z.png [2]: https://i.sstatic.net/wBylo.png
Upvotes: 0
Views: 60
Reputation: 628
check your model for 'hidden'
if a variable called $hidden is declared in model, fields added in it will not be shown.
protected $hidden = [
'password',
'remember_token',
];
Upvotes: 0
Reputation: 532
probably your model (M_Obat) is not correctly related to the right table:
try to specify it in your model class:
protected $table = 'master.ruangan';
Upvotes: 2