Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class Provinsi extends Model{
- protected $table = 'provinsi';
- protected $primaryKey = 'idprovinsi';
- protected $fillable =['namaprovinsi'];
- public function kabupaten(){
- return $this->hasMany('App\Kabupaten','idprovinsi');
- }
- }
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class Kabupaten extends Model{
- protected $table ='Kabupaten';
- protected $primaryKey = 'idkabupaten';
- protected $fillable = ['namakabupaten'];
- public function provinsi(){
- return $this->belongsTo('App\Provinsi','idprovinsi');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement