2016-02-29 15:59:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
2016-09-06 20:39:27 +00:00
|
|
|
if (!function_exists('money')) {
|
2016-04-13 14:44:07 +00:00
|
|
|
/**
|
2016-08-12 12:02:37 +00:00
|
|
|
* Format a given amount to the given currency
|
2016-04-13 14:44:07 +00:00
|
|
|
*
|
2016-08-12 12:02:37 +00:00
|
|
|
* @param $amount
|
|
|
|
|
* @param \App\Models\Currency $currency
|
2016-04-13 14:44:07 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2019-08-24 06:55:14 +00:00
|
|
|
function money($amount, \App\Models\Currency $currency = null)
|
2016-04-13 14:44:07 +00:00
|
|
|
{
|
2019-08-24 06:55:14 +00:00
|
|
|
if(!$currency){
|
|
|
|
|
return number_format($amount,0,'.',',');
|
|
|
|
|
}
|
2016-09-06 20:39:27 +00:00
|
|
|
return $currency->symbol_left . number_format($amount, $currency->decimal_place, $currency->decimal_point,
|
|
|
|
|
$currency->thousand_point) . $currency->symbol_right;
|
2016-04-13 14:44:07 +00:00
|
|
|
}
|
2016-03-05 00:18:10 +00:00
|
|
|
}
|
2019-08-24 06:55:14 +00:00
|
|
|
if(!function_exists('main_categories')){
|
2016-04-13 14:44:07 +00:00
|
|
|
|
2019-08-24 06:55:14 +00:00
|
|
|
/**
|
|
|
|
|
* return main categories
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
function main_categories(){
|
|
|
|
|
return \App\Models\Category::main()->pluck(trans('Category.category_title'),'id');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(! function_exists('sub_categories')){
|
|
|
|
|
/**
|
|
|
|
|
* return sub categoreies
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function sub_categories(){
|
|
|
|
|
return \App\Models\Category::sub()
|
|
|
|
|
->select(trans('Category.category_title'),'id','parent_id')
|
|
|
|
|
->get();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-26 13:17:34 +00:00
|
|
|
if(!function_exists('organisers')){
|
2016-04-13 14:44:07 +00:00
|
|
|
|
2019-08-26 13:17:34 +00:00
|
|
|
function organisers(){
|
|
|
|
|
if(Illuminate\Support\Facades\Auth::user()->is_admin)
|
|
|
|
|
return \App\Models\Organiser::all();
|
|
|
|
|
else
|
|
|
|
|
return \Illuminate\Support\Facades\Auth::user()->account->organisers;
|
|
|
|
|
}
|
|
|
|
|
}
|