PHP Class App\Http\Controllers\ProductsController

Inheritance: extends Controller
Show file Open project: ant-vel/antVel Class Usage Examples

Public Methods

Method Description
changeStatus ( integer $id ) : Response Change status a Product.
create ( ) : Response Show the form for creating a new resource.
deleteImg ( Illuminate\Http\Request $request ) : string delete image file.
destroy ( integer $id ) : Response Remove the specified resource from storage.
downloadExample ( ) : string dowload file txt example.
edit ( integer $id ) : Response Show the form for editing the specified resource.
getFeatures ( array $data = [] ) : [type] getFeatures Allows consulting products features. It can return either a required feature or a full array.
getRandCategoryId ( ) : [integer] To get a existing category id from products.
getSuggestions ( $data ) : [array] To get the products suggestion, taking in account either the preference key, such as (product_viewed, product_purchased, product_shared, product_categories, my_searches), or all of them.
getTagsCategories ( $tags = [] ) : [array] Get the category id from tags array.
getTopRated ( [integer] $point = '5', [integer] $limit = 5, [boolean] $tags = false ) : [array This method is able to return the higher rate product list, everything will depends of $point parameter.
index ( Illuminate\Http\Request $request ) : Response Display a listing of the resource.
myProducts ( Illuminate\Http\Request $request )
searchAll ( Illuminate\Http\Request $request ) : [type] [Search products in auto complete fields].
setCounters ( [object] $product = null, [array] $data = [], [string] $wrapper = '' ) Increase the product counters.
show ( integer $id ) : Response Display the specified resource.
store ( Illuminate\Http\Request $request ) : Response Store a newly created resource in storage.
update ( integer $id, Illuminate\Http\Request $request ) : Response Update the specified resource in storage.
upload ( Illuminate\Http\Request $request ) : string upload image file.
upload_key ( Illuminate\Http\Request $request ) : string upload the keys file in txt format.
upload_software ( Illuminate\Http\Request $request ) : string upload the software file in txt format.

Private Methods

Method Description
rulesByTypes ( $request, $edit = false )
validateFeatures ( [array] $data ) : [string | array] validate product feature, as specified in the table of product details.
validationMessagesFeatures ( [string] $rules, [string] $index, [string] $name ) : [array] create the error message by taking the name feature, and validation rules.

Method Details

changeStatus() public method

Change status a Product.
public changeStatus ( integer $id ) : Response
$id integer
return Response

create() public method

Show the form for creating a new resource.
public create ( ) : Response
return Response

deleteImg() public method

@param Resquest file to upload
public deleteImg ( Illuminate\Http\Request $request ) : string
$request Illuminate\Http\Request
return string

destroy() public method

Remove the specified resource from storage.
public destroy ( integer $id ) : Response
$id integer
return Response

downloadExample() public method

@param Resquest file to upload
public downloadExample ( ) : string
return string

edit() public method

Show the form for editing the specified resource.
public edit ( integer $id ) : Response
$id integer
return Response

getFeatures() public method

getFeatures Allows consulting products features. It can return either a required feature or a full array.
public getFeatures ( array $data = [] ) : [type]
$data array function setting
return [type]

getRandCategoryId() public static method

To get a existing category id from products.
public static getRandCategoryId ( ) : [integer]
return [integer]

getSuggestions() public static method

To get the products suggestion, taking in account either the preference key, such as (product_viewed, product_purchased, product_shared, product_categories, my_searches), or all of them.
public static getSuggestions ( $data ) : [array]
return [array]

getTagsCategories() public static method

Get the category id from tags array.
public static getTagsCategories ( $tags = [] ) : [array]
return [array]

getTopRated() public static method

This method is able to return the higher rate product list, everything will depends of $point parameter.
public static getTopRated ( [integer] $point = '5', [integer] $limit = 5, [boolean] $tags = false ) : [array
$point [integer]
$limit [integer]
$tags [boolean]
return [array

index() public method

Display a listing of the resource.
public index ( Illuminate\Http\Request $request ) : Response
$request Illuminate\Http\Request
return Response

myProducts() public method

public myProducts ( Illuminate\Http\Request $request )
$request Illuminate\Http\Request

searchAll() public method

[Search products in auto complete fields].
public searchAll ( Illuminate\Http\Request $request ) : [type]
$request Illuminate\Http\Request [Request laravel]
return [type]

setCounters() public static method

Increase the product counters.
public static setCounters ( [object] $product = null, [array] $data = [], [string] $wrapper = '' )
$product [object]
$data [array]
$wrapper [string]

show() public method

Display the specified resource.
public show ( integer $id ) : Response
$id integer
return Response

store() public method

Store a newly created resource in storage.
public store ( Illuminate\Http\Request $request ) : Response
$request Illuminate\Http\Request
return Response

update() public method

Update the specified resource in storage.
public update ( integer $id, Illuminate\Http\Request $request ) : Response
$id integer
$request Illuminate\Http\Request
return Response

upload() public method

@param Resquest file to upload
public upload ( Illuminate\Http\Request $request ) : string
$request Illuminate\Http\Request
return string

upload_key() public method

@param Resquest file to upload
public upload_key ( Illuminate\Http\Request $request ) : string
$request Illuminate\Http\Request
return string

upload_software() public method

@param Resquest file to upload
public upload_software ( Illuminate\Http\Request $request ) : string
$request Illuminate\Http\Request
return string