Add endpoint and backend for managing postcode

This commit is contained in:
afiq.hamzah
2023-03-16 16:38:08 +08:00
parent bc41c09210
commit 5e94cae9a0
3 changed files with 52 additions and 4 deletions
+11
View File
@@ -3,10 +3,12 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Poskod extends Model
{
protected $table = 'poskod';
protected $primaryKey = 'recno';
public $timestamps = false;
/**
@@ -26,4 +28,13 @@ class Poskod extends Model
* @var array
*/
// protected $hidden = [];
public function negeri(): BelongsTo {
return $this->belongsTo(Negeri::class, 'kodnegeri', 'kodnegeri');
}
public function daerah(): BelongsTo {
return $this->belongsTo(Daerah::class, 'koddaerah', 'koddaerah');
}
}