
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
39 lines
852 B
PHP
39 lines
852 B
PHP
<?php
|
|
|
|
namespace App\Model\helpdesk\Settings;
|
|
|
|
use App\BaseModel;
|
|
|
|
class CommonSettings extends BaseModel
|
|
{
|
|
protected $table = 'common_settings';
|
|
|
|
protected $fillable = [
|
|
'status', 'option_name', 'option_value', 'optional_field', 'created_at', 'updated_at',
|
|
];
|
|
|
|
public function getStatus($option_name)
|
|
{
|
|
$status = '';
|
|
$schema = $this->where('option_name', $option_name)->first();
|
|
if ($schema) {
|
|
$status = $schema->status;
|
|
}
|
|
|
|
return $status;
|
|
}
|
|
|
|
public function getOptionValue($option, $field = '')
|
|
{
|
|
$schema = $this->where('option_name', $option);
|
|
if ($field != '') {
|
|
$schema = $schema->where('optional_field', $field);
|
|
|
|
return $schema->first();
|
|
}
|
|
$value = $schema->get();
|
|
|
|
return $value;
|
|
}
|
|
}
|