26 lines
663 B
PHP
26 lines
663 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Articles extends Model
|
|
{
|
|
public function category()
|
|
{
|
|
return $this->belongsTo('App\Models\ArticlesCategories');
|
|
}
|
|
|
|
public function recipes() {
|
|
return $this->belongsToMany('App\Models\Recipes', 'recipes_articles', 'article_id', 'recipe_id');
|
|
}
|
|
|
|
public function answers()
|
|
{
|
|
return $this->hasMany('App\Models\SurveysAnswers', 'article_id');
|
|
}
|
|
|
|
public function surveys_answers_users() {
|
|
return $this->hasManyThrough('App\Models\SurveysAnswers', 'App\Models\SurveysAnswersUsers', 'survey_answer_id', 'article_id');
|
|
}
|
|
}
|