i have tow tables
***products : id, title ,price, created_at, updated_at
---i stock products here
***product_details : id, product_id,sell, created_at, updated_at
---i stock number of sell for every day
example
products:
-----1-product 1- 2.9 - created_at, updated_at
-----2-product 2- 3.94 - created_at, updated_at
-----3-product 3- 1.94 - created_at, updated_at
product_details :
-----1-2- 3 - created_at, updated_at
-----2-1- 6 - created_at, updated_at
-----3-3- 8 - created_at, updated_at
-----4-2- 6 - created_at, updated_at
-----5-1- 7 - created_at, updated_at
-----6-3- 11 - created_at, updated_at
i have tow models
class Product extends Model
{
public function product_details()
{
return $this->hasMany('App\Product_detail');
}
}
the second
class Product_detail extends Model
{
//
public function product()
{
return $this->belongsTo('App\Product');
}
}
i want to select products with the last day sell is between 5 and 8; jsut the last day
and i want select the products with the last day sell is between 5 and 8 and the created_at is between tow dates;
I tried to test with different code to make it but i field so i think the solution is here. Any suggestions ?
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2FcwrHM
via IFTTT
Aucun commentaire:
Enregistrer un commentaire