Last active
September 5, 2017 11:19
-
-
Save ambrizals/6296e15c7be1d7323ec49078720fd8b8 to your computer and use it in GitHub Desktop.
Error : 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function CategoryArticle(){ | |
return $this->belongsTo('App\CategoryArticle','kategori_article','id_category'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function viewArticle($slug_article){ | |
$article = Article::where('slug_article', $slug_article)->first()->with('Article.CategoryArticle')->get(); | |
$halaman = 'blog'; | |
return view('article.show', compact('article','halaman')); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function CategoryArticle(){ | |
return $this->hasMany('App\Article'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@foreach ($article as $item) | |
<h2>{!! $item->judul_article !!}</h2> | |
{!! $item->konten_article !!} | |
{!! $item->CategoryArticle->nama_kategori !!} | |
@endforeach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment