⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.138
Server IP:
186.226.58.36
Server:
Linux da02.sh15.net 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
Server Software:
Apache/2
PHP Version:
8.1.32
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
redesystem
/
public_html
/
sys
/
app
/
Models
/
View File Name :
State.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * App\Models\State * * @property int $id * @property string $name * @property int $country_id * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property-read \App\Models\City $city * @property-read \App\Models\Country $country * @property-read string $country_name * * @method static \Illuminate\Database\Eloquent\Builder|State newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|State newQuery() * @method static \Illuminate\Database\Eloquent\Builder|State query() * @method static \Illuminate\Database\Eloquent\Builder|State whereCountryId($value) * @method static \Illuminate\Database\Eloquent\Builder|State whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|State whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|State whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|State whereUpdatedAt($value) * * @mixin \Eloquent */ class State extends Model { use HasFactory; public $table = 'states'; public $fillable = [ 'name', 'country_id', ]; /** * The attributes that should be casted to native types. * * @var array */ protected $casts = [ 'name' => 'string', 'country_id' => 'integer', ]; /** * Validation rules * * @var array */ public static $rules = [ 'name' => 'required|string|max:170|unique:states,name', 'country_id' => 'required', ]; protected $appends = ['country_name']; public function getCountryNameAttribute(): string { return $this->country->name ?? 'N/A'; } public function country(): BelongsTo { return $this->belongsTo(Country::class, 'country_id'); } public function city(): belongsTo { return $this->belongsTo(City::class, 'state_id'); } }