Helpers are a quck functions what you can use anywhere in your theme or module it may be caled like function_name($params). Many of helpers you can find in Laravel Documentations. There is two tipe of helpers simple methods and OOP hepers
1) app/Helpers/helpers.php
2) app/Helpers/HelperController.php
Link to quick edit
url - is the linkt to admin panel
quickEdit('/admin/page/add-edit/pages/20');
This method show the first 300 words from text
the limit you can control like bellow 10 words
excerpt('Yur text go here', 10);
excerpt($contetnt='', $limit=300)
this will get the translate
{{_l("Edit")}}
_l($word="")
Get shipping cost
id - shipping id
$total - cart total; it will calculate the shipping cost from cart total
get_shipping_cost($id, $total=0)
generate link by page id
$id - page id
get_link_page(10);
Get shipping cost
$id- Shipping id
$field - field; like title or cost
get_shipping_field(20, 'title')
Will return the full product url
$cpu- product cpu
$cat - is a product cat json
function product_url($cpu="",$cat="")
Will generate a randon string
$n- length
$only_letters - only letter not numbers
get_random(20)
get current user ID if is login
id_user();
Get user role by id role
id- role id
get_role($id);
get current user role admin or editor or none
UserRole(); return admin;
if curent user role is admin it will return true other cases false
UserRole('admin'); return true or false
Get user name or email by user id
$id - user id
$field - email or name
function get_user_name(20, "name") // will return the user name where id is 20
function get_user_name('current', "email") // will return the current user email
Return field from table setting by param
$param - is any param(any word)
$field - value or value1 or value2
$field2 - if you want to geth botth like $get->$field ."~". $get->$field2 and after use explode("~", $data)
get_settings($param, $field="value", $field2="")
If you keep value in json it will return value1 in json decode : $data['email']
$param - is any param(any word)
$field - value or value1 or value2
get_settings_json($param, $field="value1" )
Return loop data from table setting by param
$param - any word
return_bulck_settings($param)
Update or insert if param is not existing
$param - is the parametr where you can recognise your data
$value - varchar(255)
$value1 - text accept big data
$value2 - varchar(255)
update_settings($param, $value="", $value1="", $value2="")
Update or insert if id is not existing
$id - id settings
$value - varchar(255)
$value1 - text accept big data
$value2 - varchar(255)
update_settings($id, $value="", $value1="", $value2="")
Crop image easy and eficient
resize_crop_image($max_width, $max_height, $source_file, $dst_dir, $quality = 80, $crop=true)
it will call an external url by curl
$url - any external url
$no_return - leave empty if you don't want to get any response
get_by_curl($url, $no_return = "")
HTML Minifier
minify_html($input)
CSS Minifier
minify_css($input)
JavaScript Minifier
minify_js($input)
Will return the image full path
* $image - it's aimage from options or just image name
* $type - thumb or big (full size)
get_thumbnail($product->optionsdata, "thumb")
Get product gallery
$idp - id Product
get_images($idp)
Will get any field from product table
id - id product
$field - title or price any field
get_product_field($id="",$field="title")
Will get all the Comments(Reviews) for the post or product
$id_post - product id
get_comments($id_post = 0)
Will return the number of commnets in array
for eaxample [5=>10, 4=>2, 3=>1, 2=>7, 1=> 5]
where array key is stars number and value is the number of comments with key stars
nr_comments(get_comments(20));
Return the Medium Stars by product id
$id_post- product id
product_stars($id_post=0)
Result will be : *****
Will return true or false if the string is a json
$string - any json string or any string
isJSON($string);
Get country field by id
id- id country
field - any field
function get_countrybyid($id, $field)
will return the category for select
$cat - categories array
$parrent - if you want to be selected
get_cat_yerahical_option($cat=[], $parent="", $nr= 0, $url="", $is_in='')
will return the category in checkbox list
$cat - categories array
$parrent - if you want to be checked
get_cat_yerahical_checkbox($cat=[], $parent="", $nr= 0, $isin=[])
get price with currency icon
$price - normal price
$sale_price - sale price
$type - if it's empty than will return the price + incrise what you setup on
Setting page link: yourwebsite.domain/admin/general-settings/
if is not empty will return a clear price.
get_price_full($price, $sale_price=0, $type='')
get price only number
$price - normal price
$sale_price - sale price
$price_option - if it's empty than will return the price + incrise what you setup on
Setting page link: yourwebsite.domain/admin/general-settings/
if is not empty will return a clear price.
function get_price_number($price=0,$sale_price=0, $price_option=0)
Print a nice array
Get menue
$value2 - top_menu or any what you selected
get_menu($value2="none")
Simple hook function
$hook- hook name like header footer
_hooks('header');
in your theme in blade or controller you can add many hooks and from config.php you can add on that part of the page any code you want
Simple Widgets function
in your theme in blade or controller you can add many widgets and from config.php you can add on that part of the page any code you want
_widgets('left_sidebar')
This is a short code function if you need to use the short code in page
$content - is page text or any text where you have some words in square scops like [search]
shortCode($content);
shortCode('[search]');
will return the logo from the settings page
_logo()
return : <a href="'.url("/").'"><img class="logo" src="'.url('/public/img/'.$logo).'"/></a>
will return the favicon from the settings page
_favicon()
return : <link rel="shortcut icon" type="image/png" href="'.url('/public/img/'.$_favicon_).'"/>
Will return the tmp_user_id from cookies when user go on the website it automaticle
generate a unic code what you can identify the user. it use for cart and checkout
@\App\Helpers\HelperController::get_sesion();
Will return the list of products from current user cart
@\App\Helpers\HelperController::get_cart();
will return the cart total
@\App\Helpers\HelperController::get_cart_total();
will return the cupon amount from total of cart
$subtotal- cart total
$nr - yes if you need it in nice array like ['subtotal'=>$subtotal, 'total'=>round($discount, 2), 'cuppon'=>$cuppon->cupon, 'discount'=> $discount_minus]
@\App\Helpers\HelperController::get_applied_cupon($subtotal=0, $nr="");
Will return the tabs content
$content - content
$product - product data
@\App\Helpers\HelperController::rightTab($content='', $product='');