activity_model.php
3 months ago
agent_meta_model.php
3 months ago
agent_model.php
3 months ago
booking_meta_model.php
3 months ago
booking_model.php
18 hours ago
bundle_meta_model.php
3 months ago
bundle_model.php
1 week ago
cart_item_model.php
3 months ago
cart_meta_model.php
3 months ago
cart_model.php
2 weeks ago
connector_model.php
3 months ago
customer_meta_model.php
3 months ago
customer_model.php
1 month ago
invoice_model.php
2 weeks ago
join_bundles_services_model.php
3 months ago
location_category_model.php
3 months ago
location_model.php
3 months ago
meta_model.php
3 months ago
model.php
2 days ago
off_period_model.php
3 months ago
order_intent_meta_model.php
3 months ago
order_intent_model.php
1 week ago
order_item_model.php
3 months ago
order_meta_model.php
3 months ago
order_model.php
1 month ago
otp_model.php
3 months ago
payment_request_model.php
3 months ago
process_job_model.php
3 months ago
process_model.php
1 month ago
recurrence_model.php
3 months ago
service_category_model.php
3 months ago
service_meta_model.php
3 months ago
service_model.php
3 months ago
session_model.php
3 months ago
settings_model.php
3 months ago
step_settings_model.php
3 months ago
transaction_intent_model.php
3 months ago
transaction_model.php
3 months ago
transaction_refund_model.php
3 months ago
work_period_model.php
3 months ago
settings_model.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | class OsSettingsModel extends OsModel { |
| 4 | var $id, |
| 5 | $name, |
| 6 | $value, |
| 7 | $created_at, |
| 8 | $updated_at; |
| 9 | |
| 10 | |
| 11 | function __construct( $id = false ) { |
| 12 | parent::__construct(); |
| 13 | $this->table_name = LATEPOINT_TABLE_SETTINGS; |
| 14 | $this->nice_names = array(); |
| 15 | |
| 16 | if ( $id ) { |
| 17 | $this->load_by_id( $id ); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | public function load_by_name( $name ) { |
| 22 | $setting = $this->where( array( 'name' => $name ) )->set_limit( 1 )->get_results_as_models(); |
| 23 | if ( $setting ) { |
| 24 | $this->id = $setting->id; |
| 25 | $this->set_data( $setting ); |
| 26 | } |
| 27 | return $this; |
| 28 | } |
| 29 | |
| 30 | |
| 31 | protected function allowed_params( $role = 'admin' ) { |
| 32 | $allowed_params = array( |
| 33 | 'name', |
| 34 | 'value', |
| 35 | ); |
| 36 | return $allowed_params; |
| 37 | } |
| 38 | |
| 39 | protected function params_to_save( $role = 'admin' ) { |
| 40 | $params_to_save = array( |
| 41 | 'name', |
| 42 | 'value', |
| 43 | ); |
| 44 | return $params_to_save; |
| 45 | } |
| 46 | |
| 47 | protected function properties_to_validate() { |
| 48 | $validations = array( |
| 49 | 'name' => array( 'presence' ), |
| 50 | ); |
| 51 | return $validations; |
| 52 | } |
| 53 | } |
| 54 |