Advertisement
satriawan

Untitled

Apr 28th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App;
  4.  
  5. use Illuminate\Database\Eloquent\Model;
  6.  
  7. class Provinsi extends Model{
  8.     protected $table = 'provinsi';
  9.     protected $primaryKey = 'idprovinsi';
  10.     protected $fillable =['namaprovinsi'];
  11.  
  12.     public function kabupaten(){
  13.         return $this->hasMany('App\Kabupaten','idprovinsi');
  14.     }
  15.  
  16. }
  17.  
  18.  
  19.  
  20. <?php
  21.  
  22. namespace App;
  23.  
  24. use Illuminate\Database\Eloquent\Model;
  25.  
  26. class Kabupaten extends Model{
  27.     protected $table ='Kabupaten';
  28.     protected $primaryKey = 'idkabupaten';
  29.     protected $fillable = ['namakabupaten'];
  30.  
  31.     public function provinsi(){
  32.         return $this->belongsTo('App\Provinsi','idprovinsi');
  33.     }  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement