First Commit
This commit is contained in:
Executable
+64
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SysCMS - Content Management System
|
||||
*
|
||||
* Copyright (c) 2026 Marco Costa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Marco Costa
|
||||
* Email: contato@syspanel.com.br
|
||||
* Project: SysCMS
|
||||
*
|
||||
* This software is licensed, not sold.
|
||||
* Permission is granted to use this software
|
||||
* subject to the terms of the SysCMS Commercial License.
|
||||
*
|
||||
* Redistribution, sublicensing, resale, or
|
||||
* disclosure of this software, in whole or in part,
|
||||
* is strictly prohibited without prior written permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
|
||||
*/
|
||||
|
||||
namespace Modules\GlobalLists\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class State
|
||||
*
|
||||
* Model representing a state (federative unit) linked to a country.
|
||||
*
|
||||
* @package Modules\GlobalLists\Models
|
||||
* @property int $states_id
|
||||
* @property int $states_country_id
|
||||
* @property string $states_name
|
||||
* @property string $states_uf
|
||||
*/
|
||||
class State extends Model
|
||||
{
|
||||
protected $table = 'lists_states';
|
||||
protected $primaryKey = 'states_id';
|
||||
protected $fillable = [
|
||||
'states_country_id',
|
||||
'states_name',
|
||||
'states_uf'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the country that owns the state.
|
||||
*/
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class, 'states_country_id', 'countries_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cities for the state.
|
||||
*/
|
||||
public function cities()
|
||||
{
|
||||
return $this->hasMany(City::class, 'cities_state_id', 'states_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user