I have 2 tables Category & Transaction
in my model Category :
public function transaction()
{
return $this->hasMany('App\Transaction');
}
in my model Transaction :
public function category()
{
return $this->belongsTo('App\Category');
}
Architecture of my Transactions table :
id | category_id | qty
Architecture of my Categories table :
id | name
Now , how to display in view which i want to display only categories that have quantity(qty) value in Transactions table , i'm may have a lot of category in categories table , but not all categories has quantity in transactions table .
Thank you
note : if my question were stupid enough, forgive me , i already spend 1 week to study about this .
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire