| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/lcmsmodels.com/public_html/app/ |
Upload File : |
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Options extends Model
{
// no timestamps
public $timestamps = false;
// table name
public $table = 'options_table';
// fillable
protected $fillable = ['option_name', 'option_value'];
// save an option
public static function update_option($name, $value)
{
// update if already exists - create if it doesn't
$option = self::where('option_name', $name)->first();
if (!$option) {
$option = new Options;
}
$option->option_name = $name;
$option->option_value = $value;
$option->save();
return $option;
}
// get an option
public static function get_option($name, $default = null)
{
$return = self::where('option_name', $name)->pluck('option_value')->first();
if (!$return)
return $default;
return $return;
}
// delete an option
public static function delete_option($name)
{
$id = self::where('option_name', $name)->pluck('id')->first();
if ($id)
return self::destroy($id);
}
// get first from a comma separated list
public static function first_from_list($comma_separated_list)
{
return reset(explode(',', $comma_separated_list));
}
}