samedi 26 décembre 2015

Background image position changes on resize

I'm using Laravel and I've a table for specifications of a product.

//products
id   -  name


//specifications
id   -   name

and

//specification_values
id   -   specification_id   -   product_id

From this table structure, how can I query the specification values for a specific product with all the specification names without manually writing the specification names in the markup?

eg: specification name : 1000 specification value.
something like $product->specification: $product->specification->value

The relation

//Models.php    
public function specValues()
{
   return $this->hasMany('App\SpecValue', 'model_id');
}

would only return the values. How about returning specification name and it's value.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire