insert die() somewhere in the view, and see if it passes. If yes, move it down, if not, move it up.
The problem is probably in the view.
Firtzberg said:
insert die() somewhere in the view, and see if it passes. If yes, move it down, if not, move it up.
The problem is probably in the view.
yes after doing some research i think there is something wrong in the view, but i can't identify it... so i insert dd() into my controller to see array returned and it returned like this
object(Artikel)#232 (20) { ["table":protected]=> string(7) "Artikel" ["fillable":protected]=> array(5) { [0]=> string(5) "judul" [1]=> string(7) "content" [2]=> string(8) "kategori" [3]=> string(6) "status" [4]=> string(6) "gambar" } ["connection":protected]=> NULL ["primaryKey":protected]=> string(2) "id" ["perPage":protected]=> int(15) ["incrementing"]=> bool(true) ["timestamps"]=> bool(true) ["attributes":protected]=> array(8) { ["id"]=> int(1) ["judul"]=> string(20) "New Website yey!! :)" ["content"]=> string(462) "
Hi, welcome to my new website!
i switch my old wordpress based website/blog to this new blog that i build my self and a little help from some templates and frameworks...
with this new website i will not only post updates about my apps, but maybe sometimes in future i will post some of tutorial and tips about programming and latest tech news and my personal opinion about what happen these days
so.. enjoy the new website :D
" ["kategori"]=> int(2) ["created_at"]=> string(19) "2014-09-14 20:26:31" ["status"]=> int(1) ["updated_at"]=> string(19) "2014-10-19 15:11:24" ["gambar"]=> string(0) "" } ["original":protected]=> array(8) { ["id"]=> int(1) ["judul"]=> string(20) "New Website yey!! :)" ["content"]=> string(462) "
Hi, welcome to my new website!
i switch my old wordpress based website/blog to this new blog that i build my self and a little help from some templates and frameworks...
with this new website i will not only post updates about my apps, but maybe sometimes in future i will post some of tutorial and tips about programming and latest tech news and my personal opinion about what happen these days
so.. enjoy the new website :D
" ["kategori"]=> int(2) ["created_at"]=> string(19) "2014-09-14 20:26:31" ["status"]=> int(1) ["updated_at"]=> string(19) "2014-10-19 15:11:24" ["gambar"]=> string(0) "" } ["relations":protected]=> array(0) { } ["hidden":protected]=> array(0) { } ["visible":protected]=> array(0) { } ["appends":protected]=> array(0) { } ["guarded":protected]=> array(1) { [0]=> string(1) "*" } ["dates":protected]=> array(0) { } ["touches":protected]=> array(0) { } ["observables":protected]=> array(0) { } ["with":protected]=> array(0) { } ["morphClass":protected]=> NULL ["exists"]=> bool(true) }
i see it returning something but not the right one... the data returned is my first array in showing all article and what i request is not that one...
it is really confusing with using route in laravel....
I think I got it.
You are calling firstOrFail(). This returns a model, not a collection!
public function index_kategori($id){
//$artikels = Artikel::where('kategori','=', $id)->firstOrFail();
$artikel = Artikel::where('kategori','=', $id)->firstOrFail();
return View::make('admins.artikels.index', compact('artikel'));
}
and the view
<?php $i=0; ?>
@foreach($artikels as $artikel) ->remove this
<?php $i++; ?>
<tr>
...
</tr>
@endforeach ->remove this
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community