ldc-legaulois/app/Models/Recipes.php

28 lines
743 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Recipes extends Model
{
public function articles() {
return $this->belongsToMany('App\Models\Articles', 'recipes_articles', 'recipe_id', 'article_id');
}
public function products() {
return $this->hasMany('App\Models\Products', 'recipe_id');
}
public function product1() {
return $this->belongsTo('App\Models\Products', 'associated_product1');
}
public function product2() {
return $this->belongsTo('App\Models\Products', 'associated_product2');
}
public function customers() {
return $this->belongsToMany('App\Models\Customers', 'customer_recipe', 'recipe_id', 'customer_id');
}
}