182 lines
4.0 KiB
PHP
Executable File
182 lines
4.0 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Libraries;
|
|
|
|
use App;
|
|
|
|
class StaticContents
|
|
{
|
|
/**
|
|
* Type names for Promotion Types
|
|
* @param integer $id
|
|
* @return array / string
|
|
*/
|
|
public static function promo_type($value = 0, $return_id = false)
|
|
{
|
|
if($return_id)
|
|
{
|
|
$type = [
|
|
'General' => 1, // regardless of the user type
|
|
'Loyalty Exclusive' => 2, // logged in loyalty member
|
|
'User Specific' => 3, // based on the birthday of the logged in user
|
|
];
|
|
}
|
|
else
|
|
{
|
|
$type = [
|
|
1 => 'General',
|
|
2 => 'Loyalty Exclusive',
|
|
3 => 'User Specific',
|
|
];
|
|
}
|
|
|
|
if($value)
|
|
{
|
|
if(isset($type[$value]))
|
|
return $type[$value];
|
|
}
|
|
else
|
|
return $type;
|
|
}
|
|
|
|
/**
|
|
* Status for admin
|
|
* @param integer $id
|
|
* @return array / string
|
|
*/
|
|
public static function admin_status($value = null, $return_id = false)
|
|
{
|
|
if($return_id)
|
|
{
|
|
$status = [
|
|
'active' => 0,
|
|
'inactive' => 1,
|
|
];
|
|
}
|
|
else
|
|
{
|
|
$status = [
|
|
0 => 'active',
|
|
1 => 'inactive',
|
|
];
|
|
}
|
|
|
|
if(!is_null($value))
|
|
{
|
|
if(isset($status[$value]))
|
|
return $status[$value];
|
|
}
|
|
else
|
|
return $status;
|
|
}
|
|
|
|
/**
|
|
* Status for member (checks if the member is validated)
|
|
* @param integer $id
|
|
* @return array / string
|
|
*/
|
|
public static function member_status($value, $return_id = false)
|
|
{
|
|
if($return_id)
|
|
{
|
|
$status = [
|
|
'inactive' => 0,
|
|
'active' => 1,
|
|
];
|
|
}
|
|
else
|
|
{
|
|
$status = [
|
|
0 => 'inactive',
|
|
1 => 'active',
|
|
];
|
|
}
|
|
|
|
if(!is_null($value))
|
|
{
|
|
if(isset($status[$value]))
|
|
return $status[$value];
|
|
}
|
|
else
|
|
return $status;
|
|
}
|
|
|
|
/**
|
|
* Lock code for loyalty_card
|
|
* @param integer $id
|
|
* @return array / string
|
|
*/
|
|
public static function lock_code($value)
|
|
{
|
|
$code = [
|
|
'01' => 'Account is locked due to wrong OTP entered for 3 times during login',
|
|
'02' => 'Account is locked due to wrong OTP entered for 3 times when updating the mobile phone number',
|
|
];
|
|
|
|
if(!is_null($value))
|
|
{
|
|
if(isset($code[$value]))
|
|
return $code[$value];
|
|
}
|
|
else
|
|
return $code;
|
|
}
|
|
|
|
/**
|
|
* Fuel Codes via Database
|
|
* @param integer $id
|
|
* @return array / string
|
|
*/
|
|
public static function fuelType_code($value = null)
|
|
{
|
|
$fuel_code = App\CodeFuelType::where('is_active',1)->get();
|
|
|
|
$code = [];
|
|
|
|
foreach ($fuel_code as $key => $v) {
|
|
$code[$v['code']] = $v['description'];
|
|
}
|
|
|
|
if(!is_null($value))
|
|
{
|
|
if(isset($code[$value]))
|
|
return $code[$value];
|
|
}
|
|
else
|
|
return $code;
|
|
}
|
|
|
|
/**
|
|
* Station ID of APP via Database
|
|
* @param
|
|
* @return integer id
|
|
*/
|
|
public static function app_station_id()
|
|
{
|
|
$station = App\Station::where('code','APP')
|
|
->where('is_active',1)
|
|
->first();
|
|
|
|
if($station)
|
|
return $station->station_id;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* Station Code for in-app purchase
|
|
* @param
|
|
* @return integer id
|
|
*/
|
|
public static function in_app_stations()
|
|
{
|
|
$code = [
|
|
'APP' => 'APP',
|
|
'SMS' => 'SMS',
|
|
'WEB' => 'WEB'
|
|
];
|
|
|
|
return $code;
|
|
}
|
|
}
|