diff --git a/app/Models/Articles.php b/app/Models/Articles.php index 6e4047ff..bec3c0b7 100644 --- a/app/Models/Articles.php +++ b/app/Models/Articles.php @@ -8,19 +8,26 @@ class Articles extends Model { public function category() { - return $this->belongsTo('App\Models\ArticlesCategories'); + return $this->belongsTo(ArticlesCategories::class); } - public function recipes() { - return $this->belongsToMany('App\Models\Recipes', 'recipes_articles', 'article_id', 'recipe_id'); + public function recipes() + { + return $this->belongsToMany(Recipes::class); } public function answers() { - return $this->hasMany('App\Models\SurveysAnswers', 'article_id'); + return $this->hasMany(SurveysAnswers::class); } - public function surveys_answers_users() { - return $this->hasManyThrough('App\Models\SurveysAnswers', 'App\Models\SurveysAnswersUsers', 'survey_answer_id', 'article_id'); + public function surveysAnswersUsers() + { + return $this->hasManyThrough( + SurveysAnswers::class, + SurveysAnswersUsers::class, + 'survey_answer_id', + 'article_id' + ); } } diff --git a/app/Models/ArticlesCategories.php b/app/Models/ArticlesCategories.php index 7b34c4ed..c2aefc32 100644 --- a/app/Models/ArticlesCategories.php +++ b/app/Models/ArticlesCategories.php @@ -8,6 +8,6 @@ class ArticlesCategories extends Model { public function articles() { - return $this->hasMany('App\Models\Articles'); + return $this->hasMany(Articles::class); } } diff --git a/app/Models/BalancedMenus.php b/app/Models/BalancedMenus.php index 54a6b276..54f77d8d 100644 --- a/app/Models/BalancedMenus.php +++ b/app/Models/BalancedMenus.php @@ -16,7 +16,8 @@ class BalancedMenus extends Model protected $table = 'balanced_menus'; - public function product() { - return $this->belongsTo('App\Models\Products', 'product_id'); + public function product() + { + return $this->belongsTo(Products::class); } } diff --git a/app/Models/Breeders.php b/app/Models/Breeders.php index 046ed4b6..11d989dd 100644 --- a/app/Models/Breeders.php +++ b/app/Models/Breeders.php @@ -12,11 +12,11 @@ class Breeders extends Model public function site() { - return $this->hasOne('App\Models\BreedersSites', 'breeder_id'); + return $this->hasOne(BreedersSites::class); } public function inuavs() { - return $this->hasMany('App\Models\BreedersInuav', 'breeder_id'); + return $this->hasMany(BreedersInuav::class); } } diff --git a/app/Models/BreedersInuav.php b/app/Models/BreedersInuav.php index d445423f..18f017a7 100644 --- a/app/Models/BreedersInuav.php +++ b/app/Models/BreedersInuav.php @@ -11,6 +11,6 @@ class BreedersInuav extends Model public function breeder() { - return $this->belongsTo('App\Models\Breeders', 'breeder_id'); + return $this->belongsTo(Breeders::class); } } diff --git a/app/Models/BreedersSites.php b/app/Models/BreedersSites.php index 5452f9da..32e88610 100644 --- a/app/Models/BreedersSites.php +++ b/app/Models/BreedersSites.php @@ -16,6 +16,6 @@ class BreedersSites extends Model public function breeder() { - return $this->belongsTo('App\Models\Breeders', 'breeder_id'); + return $this->belongsTo(Breeders::class); } } diff --git a/app/Models/ConsumptionTimes.php b/app/Models/ConsumptionTimes.php index 14a2b46f..23c45ae2 100644 --- a/app/Models/ConsumptionTimes.php +++ b/app/Models/ConsumptionTimes.php @@ -6,7 +6,8 @@ use Illuminate\Database\Eloquent\Model; class ConsumptionTimes extends Model { - public function products() { - return $this->hasMany('App\Models\Products', 'consumption_times_id'); + public function products() + { + return $this->hasMany(Products::class, 'consumption_times_id'); } } diff --git a/app/Models/Countries.php b/app/Models/Countries.php index 00a3acc5..b65f6f51 100644 --- a/app/Models/Countries.php +++ b/app/Models/Countries.php @@ -6,7 +6,8 @@ use Illuminate\Database\Eloquent\Model; class Countries extends Model { - public function products() { - return $this->hasMany('App\Models\Products', 'country_id'); + public function products() + { + return $this->hasMany(Products::class, 'country_id'); } } diff --git a/app/Models/Customers.php b/app/Models/Customers.php index 2e6c8a39..04b0523d 100644 --- a/app/Models/Customers.php +++ b/app/Models/Customers.php @@ -11,19 +11,23 @@ class Customers extends Authenticatable protected $guard = 'customer'; - public function recipes() { - return $this->belongsToMany('App\Models\Recipes', 'customer_recipe', 'customer_id', 'recipe_id'); + public function recipes() + { + return $this->belongsToMany(Recipes::class); } - public function products() { - return $this->belongsToMany('App\Models\Products', 'cart', 'customer_id', 'product_id'); + public function products() + { + return $this->belongsToMany(Products::class, 'cart'); } - public function forums() { - return $this->hasMany('App\Models\Forum', 'customer_id'); + public function forums() + { + return $this->hasMany(Forum::class); } - public function answers() { - return $this->hasMany('App\Models\ForumAnswers', 'customer_id'); + public function answers() + { + return $this->hasMany(ForumAnswers::class); } } diff --git a/app/Models/FaqQuestions.php b/app/Models/FaqQuestions.php index 782a17fb..1b2471fb 100644 --- a/app/Models/FaqQuestions.php +++ b/app/Models/FaqQuestions.php @@ -8,7 +8,7 @@ class FaqQuestions extends Model { public function theme() { - return $this->belongsTo('App\Models\FaqThemes'); + return $this->belongsTo(FaqThemes::class); } public function getUtilityAttribute() { diff --git a/app/Models/FaqThemes.php b/app/Models/FaqThemes.php index 31af4114..75f7ad8f 100644 --- a/app/Models/FaqThemes.php +++ b/app/Models/FaqThemes.php @@ -8,6 +8,6 @@ class FaqThemes extends Model { public function questions() { - return $this->hasMany('App\Models\FaqQuestions'); + return $this->hasMany(FaqQuestions::class); } } diff --git a/app/Models/Forum.php b/app/Models/Forum.php index 54494a0d..e3e3fd18 100644 --- a/app/Models/Forum.php +++ b/app/Models/Forum.php @@ -6,15 +6,18 @@ use Illuminate\Database\Eloquent\Model; class Forum extends Model { - public function theme() { - return $this->belongsTo('App\Models\ForumThemes', 'theme_id'); + public function theme() + { + return $this->belongsTo(ForumThemes::class, 'theme_id'); } - public function customer() { - return $this->belongsTo('App\Models\Customers', 'customer_id'); + public function customer() + { + return $this->belongsTo(Customers::class, 'customer_id'); } - public function answers() { - return $this->hasMany('App\Models\ForumAnswers', 'forum_id'); + public function answers() + { + return $this->hasMany(ForumAnswers::class, 'forum_id'); } } diff --git a/app/Models/ForumAnswers.php b/app/Models/ForumAnswers.php index 908148ad..36465e16 100644 --- a/app/Models/ForumAnswers.php +++ b/app/Models/ForumAnswers.php @@ -6,11 +6,13 @@ use Illuminate\Database\Eloquent\Model; class ForumAnswers extends Model { - public function forum() { - return $this->belongsTo('App\Models\Forum', 'forum_id'); + public function forum() + { + return $this->belongsTo(Forum::class); } - public function customer() { - return $this->belongsTo('App\Models\Customers', 'customer_id'); + public function customer() + { + return $this->belongsTo(Customers::class); } } diff --git a/app/Models/ForumThemes.php b/app/Models/ForumThemes.php index 8a0fa98e..fe90299c 100644 --- a/app/Models/ForumThemes.php +++ b/app/Models/ForumThemes.php @@ -6,7 +6,8 @@ use Illuminate\Database\Eloquent\Model; class ForumThemes extends Model { - public function forums() { - return $this->hasMany('App\Models\Forum', 'theme_id'); + public function forums() + { + return $this->hasMany(Forum::class, 'theme_id'); } } diff --git a/app/Models/MeatTypes.php b/app/Models/MeatTypes.php index 146957b0..b31280de 100644 --- a/app/Models/MeatTypes.php +++ b/app/Models/MeatTypes.php @@ -6,7 +6,8 @@ use Illuminate\Database\Eloquent\Model; class MeatTypes extends Model { - public function products() { - return $this->hasMany('App\Models\Products', 'meat_type_id'); + public function products() + { + return $this->hasMany(Products::class, 'meat_type_id'); } } diff --git a/app/Models/Moments.php b/app/Models/Moments.php index 05f70da5..3ec25cbe 100644 --- a/app/Models/Moments.php +++ b/app/Models/Moments.php @@ -6,7 +6,8 @@ use Illuminate\Database\Eloquent\Model; class Moments extends Model { - public function strates() { - return $this->hasMany('App\Models\MomentStrates', 'moment_id'); + public function strates() + { + return $this->hasMany(MomentStrates::class); } } diff --git a/app/Models/ProductPictograms.php b/app/Models/ProductPictograms.php index c9648565..c7304a19 100644 --- a/app/Models/ProductPictograms.php +++ b/app/Models/ProductPictograms.php @@ -6,7 +6,8 @@ use Illuminate\Database\Eloquent\Model; class ProductPictograms extends Model { - public function products() { - return $this->belongsToMany('App\Models\Products', "products_pictograms", "id_pictogram", "id_product"); + public function products() + { + return $this->belongsToMany(Products::class, "products_pictograms", "id_pictogram", "id_product"); } } diff --git a/app/Models/Products.php b/app/Models/Products.php index 42ed73ae..50a65455 100644 --- a/app/Models/Products.php +++ b/app/Models/Products.php @@ -25,63 +25,75 @@ class Products extends Model return $this->belongsTo(Ranges::class); } + //TODO: PSR1 is not in camel caps format public function meat_type() { - return $this->belongsTo('App\Models\MeatTypes', 'meat_type_id'); + return $this->belongsTo(MeatTypes::class, 'meat_type_id'); } + //TODO: PSR1 is not in camel caps format public function consumption_times() { - return $this->belongsTo('App\Models\ConsumptionTimes', 'consumption_times_id'); + return $this->belongsTo(ConsumptionTimes::class, 'consumption_times_id'); } public function recipe() { - return $this->belongsTo('App\Models\Recipes', 'recipe_id'); + return $this->belongsTo(Recipes::class); } public function country() { - return $this->belongsTo('App\Models\Countries', 'country_id'); + return $this->belongsTo(Countries::class, 'country_id '); } public function society() { - return $this->belongsTo('App\Models\Societies', 'society_id'); + return $this->belongsTo(Societies::class, 'society_id '); } + //TODO: PSR1 is not in camel caps format public function sale_family() { - return $this->belongsTo('App\Models\SalesFamilies', 'sale_family_id'); + return $this->belongsTo(SalesFamilies::class, 'sale_family_id '); } + //TODO: PSR1 is not in camel caps format public function inco_nutritional_values() { - return $this->hasOne('App\Models\INCONutritionalValues', 'product_id'); + return $this->hasOne(INCONutritionalValues::class); } + //TODO: PSR1 is not in camel caps format public function balanced_menu() { - return $this->hasOne('App\Models\BalancedMenus', 'product_id'); + return $this->hasOne(BalancedMenus::class); } + public function recipes() + { + return $this->belongsToMany(Recipes::class); + } + + //TODO: PSR1 is not in camel caps format public function recipes_associated_1() { - return $this->hasMany('App\Models\Recipes', 'associated_product1'); + return $this->hasMany(Recipes::class, 'associated_product1 '); } + //TODO: PSR1 is not in camel caps format public function recipes_associated_2() { - return $this->hasMany('App\Models\Recipes', 'associated_product2'); + return $this->hasMany(Recipes::class, 'associated_product2 '); } public function customers() { - return $this->belongsToMany('App\Models\Customers', 'cart', 'product_id', 'customer_id'); + return $this->belongsToMany(Customers::class, 'cart'); } public function reductions() { - return $this->belongsToMany('App\Models\Reductions', 'reduction_config', 'product_id', 'reduction_id'); + return $this->belongsToMany(Reductions::class, 'reduction_config'); } } diff --git a/app/Models/Ranges.php b/app/Models/Ranges.php index 77095fe5..b75069a2 100644 --- a/app/Models/Ranges.php +++ b/app/Models/Ranges.php @@ -22,6 +22,6 @@ class Ranges extends Model public function reductions() { - return $this->belongsToMany('App\Models\Reductions', 'reduction_config', 'range_id', 'reduction_id'); + return $this->belongsToMany(Reductions::class, 'reduction_config'); } } diff --git a/app/Models/Recipes.php b/app/Models/Recipes.php index 03e3e25d..404ff37c 100644 --- a/app/Models/Recipes.php +++ b/app/Models/Recipes.php @@ -27,21 +27,21 @@ class Recipes extends Model public function products() { - return $this->hasMany('App\Models\Products', 'recipe_id'); + return $this->hasMany(Products::class); } public function product1() { - return $this->belongsTo('App\Models\Products', 'associated_product1'); + return $this->belongsTo(Products::class, 'associated_product1'); } public function product2() { - return $this->belongsTo('App\Models\Products', 'associated_product2'); + return $this->belongsTo(Products::class, 'associated_product2'); } public function customers() { - return $this->belongsToMany('App\Models\Customers', 'customer_recipe', 'recipe_id', 'customer_id'); + return $this->belongsToMany(Customers::class); } } diff --git a/app/Models/Reductions.php b/app/Models/Reductions.php index bf07eafd..f6024b9f 100644 --- a/app/Models/Reductions.php +++ b/app/Models/Reductions.php @@ -6,11 +6,13 @@ use Illuminate\Database\Eloquent\Model; class Reductions extends Model { - public function products() { - return $this->belongsToMany('App\Models\Products', 'reduction_config', 'reduction_id', 'product_id'); + public function products() + { + return $this->belongsToMany(Products::class, 'reduction_config'); } - public function ranges() { - return $this->belongsToMany('App\Models\Ranges', 'reduction_config', 'reduction_id', 'range_id'); + public function ranges() + { + return $this->belongsToMany(Ranges::class, 'reduction_config', 'reduction_id', 'range_id'); } } diff --git a/app/Models/SalesFamilies.php b/app/Models/SalesFamilies.php index 1134344d..3169aa98 100644 --- a/app/Models/SalesFamilies.php +++ b/app/Models/SalesFamilies.php @@ -6,7 +6,8 @@ use Illuminate\Database\Eloquent\Model; class SalesFamilies extends Model { - public function products() { - return $this->hasMany('App\Models\Products', 'sale_family_id'); + public function products() + { + return $this->hasMany(Products::class, 'sale_family_id'); } } diff --git a/app/Models/Societies.php b/app/Models/Societies.php index ab24796b..a6db78ed 100644 --- a/app/Models/Societies.php +++ b/app/Models/Societies.php @@ -6,7 +6,8 @@ use Illuminate\Database\Eloquent\Model; class Societies extends Model { - public function products() { - return $this->hasMany('App\Models\Products', 'society_id'); + public function products() + { + return $this->hasMany(Products::class, 'society_id'); } } diff --git a/app/Models/SurveysAnswers.php b/app/Models/SurveysAnswers.php index 81f03790..97c8fb1a 100644 --- a/app/Models/SurveysAnswers.php +++ b/app/Models/SurveysAnswers.php @@ -11,6 +11,6 @@ class SurveysAnswers extends Model public function article() { - return $this->belongsTo('App\Models\Articles', 'article_id'); + return $this->belongsTo(Articles::class); } }