\App\Http\ModelsProduct

Class Product Product model.

Summary

Methods
Properties
Constants
getPriceAttribute()
scopeByCategory()
scopeGetID()
scopeFeatured()
scopePublished()
scopePublishedProducts()
scopeSearch()
scopePriceFromProductID()
scopeProductSummaryProductID()
category()
additionalImages()
No public properties found
No constants found
No protected methods found
$fillable
N/A
No private methods found
No private properties found
N/A

Properties

$fillable

$fillable : 

Type

Methods

getPriceAttribute()

getPriceAttribute(  $value) : mixed

Accessor for price based on env config.

Parameters

$value

Returns

mixed

scopeByCategory()

scopeByCategory(  $query,   $category_id) : mixed

Get products by category_id TODO: Switch to relationship based fetching.

Parameters

$query
$category_id

Returns

mixed

scopeGetID()

scopeGetID(  $query,   $slug) : mixed

Get product using product_id.

Parameters

$query
$slug

Returns

mixed

scopeFeatured()

scopeFeatured(  $query) : mixed

Returns latest 9 featured products.

Parameters

$query

Returns

mixed

scopePublished()

scopePublished(  $query) 

Parameters

$query

scopePublishedProducts()

scopePublishedProducts(  $query,   $take,   $skip) : mixed

Returns featured products based on limit().

Parameters

$query
$take
$skip

Returns

mixed

scopeSearch()

scopeSearch(  $query,   $search) : mixed

Fetch search results for products search by product title, make, description or details.

Parameters

$query
$search

Returns

mixed

scopePriceFromProductID()

scopePriceFromProductID(  $query,   $product_id) : mixed

Get price of the product from product_id.

Parameters

$query
$product_id

Returns

mixed

scopeProductSummaryProductID()

scopeProductSummaryProductID(  $query,   $product_id) : mixed

Get product details from product_id.

Parameters

$query
$product_id

Returns

mixed

category()

category() : \Illuminate\Database\Eloquent\Relations\BelongsTo

Product belong a category.

Returns

\Illuminate\Database\Eloquent\Relations\BelongsTo

additionalImages()

additionalImages() : \Illuminate\Database\Eloquent\Relations\HasMany

A product has many product images.

Returns

\Illuminate\Database\Eloquent\Relations\HasMany