| @@ 8-34 (lines=27) @@ | ||
| 5 | use Illuminate\Database\Eloquent\Model; |
|
| 6 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
| 7 | ||
| 8 | class ItemModel extends Model |
|
| 9 | { |
|
| 10 | ||
| 11 | protected $table = 'pbj_items'; |
|
| 12 | public $timestamps = true; |
|
| 13 | ||
| 14 | use SoftDeletes; |
|
| 15 | ||
| 16 | protected $dates = ['deleted_at']; |
|
| 17 | protected $fillable = array('uuid', 'keterangan', 'tarif', 'jumlah', 'subtotal', 'transaksi_id', 'tarif_id', 'rekening_id'); |
|
| 18 | ||
| 19 | public function getTransaksi() |
|
| 20 | { |
|
| 21 | return $this->hasOne('Transaksi', 'transaksi_id'); |
|
| 22 | } |
|
| 23 | ||
| 24 | public function getRekening() |
|
| 25 | { |
|
| 26 | return $this->belongsTo('Rekening', 'rekening_id'); |
|
| 27 | } |
|
| 28 | ||
| 29 | public function getTarif() |
|
| 30 | { |
|
| 31 | return $this->hasOne('Tarif', 'tarif_id'); |
|
| 32 | } |
|
| 33 | ||
| 34 | } |
|
| @@ 8-34 (lines=27) @@ | ||
| 5 | use Illuminate\Database\Eloquent\Model; |
|
| 6 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
| 7 | ||
| 8 | class TransaksiModel extends Model |
|
| 9 | { |
|
| 10 | ||
| 11 | protected $table = 'pbj_transaksies'; |
|
| 12 | public $timestamps = true; |
|
| 13 | ||
| 14 | use SoftDeletes; |
|
| 15 | ||
| 16 | protected $dates = ['deleted_at']; |
|
| 17 | protected $fillable = array('id', 'uuid', 'nomor', 'total', 'denda', 'potongan', 'admin_id', 'customer_transaksi_id', 'tarif_id'); |
|
| 18 | ||
| 19 | public function getitem() |
|
| 20 | { |
|
| 21 | return $this->hasMany('Item', 'id'); |
|
| 22 | } |
|
| 23 | ||
| 24 | public function getCustomer() |
|
| 25 | { |
|
| 26 | return $this->hasOne('CustomerRetribusi', 'customer_retribusi_id'); |
|
| 27 | } |
|
| 28 | ||
| 29 | public function getAdmin() |
|
| 30 | { |
|
| 31 | return $this->hasOne('Admin', 'admin_id'); |
|
| 32 | } |
|
| 33 | ||
| 34 | } |
|