add model, define model
parent
4a08bd5e70
commit
458ee4ee3e
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Kelas extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'kelas';
|
||||
|
||||
protected $fillable = [
|
||||
'periode_id',
|
||||
'nama'
|
||||
];
|
||||
|
||||
public function siswa(){
|
||||
return $this->hasMany('App\Models\Siswa','kelas_id','id');
|
||||
}
|
||||
|
||||
public function periode(){
|
||||
return $this->hasOne('App\Models\Periode','id','periode_id');
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Keuangan extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'keuangan';
|
||||
|
||||
protected $fillable = [
|
||||
'tabungan_id',
|
||||
'transaksi_id',
|
||||
'tipe',
|
||||
'jumlah',
|
||||
'total_kas',
|
||||
'keterangan',
|
||||
];
|
||||
|
||||
public function tabungan(){
|
||||
return $this->hasOne('App\Models\Tabungan','id','tabungan_id');
|
||||
}
|
||||
|
||||
public function transaksi(){
|
||||
return $this->hasOne('App\Models\Transaksi','id','transaksi_id');
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Role extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'role';
|
||||
|
||||
protected $fillable = [
|
||||
'tagihan_id',
|
||||
'siswa_id'
|
||||
];
|
||||
|
||||
public function siswa(){
|
||||
return $this->hasOne('App\Models\Siswa','id','siswa_id');
|
||||
}
|
||||
|
||||
public function tagihan(){
|
||||
return $this->hasOne('App\Models\Tagihan','id','tagihan_id');
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Siswa extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'siswa';
|
||||
|
||||
protected $fillable = [
|
||||
'kelas_id',
|
||||
'nama',
|
||||
'tempat_lahir',
|
||||
'tanggal_lahir',
|
||||
'jenis_kelamin',
|
||||
'alamat',
|
||||
'nama_wali',
|
||||
'telp_wali',
|
||||
'pekerjaan_wali',
|
||||
'is_yatim'
|
||||
];
|
||||
|
||||
public function kelas(){
|
||||
return $this->hasOne('App\Models\Kelas','id','kelas_id');
|
||||
}
|
||||
|
||||
public function transaksi(){
|
||||
return $this->hasMany('App\Models\Transaksi','siswa_id','id');
|
||||
}
|
||||
|
||||
public function role(){
|
||||
return $this->hasMany('App\Models\Role','siswa_id','id');
|
||||
}
|
||||
|
||||
public function tabungan(){
|
||||
return $this->hasMany('App\Models\Tabungan','siswa_id','id');
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Tabungan extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'tabungan';
|
||||
|
||||
protected $fillable = [
|
||||
'siswa_id',
|
||||
'tipe',
|
||||
'jumlah',
|
||||
'saldo',
|
||||
'keperluan'
|
||||
];
|
||||
|
||||
public function siswa(){
|
||||
return $this->belongsTo('App\Models\Siswa','id','siswa_id');
|
||||
}
|
||||
|
||||
public function keuangan(){
|
||||
return $this->hasOne('App\Models\Keuangan','tabungan_id','id');
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Tagihan extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'tagihan';
|
||||
|
||||
protected $fillable = [
|
||||
'nama',
|
||||
'jumlah',
|
||||
'wajib_semua',
|
||||
'hanya_kelas'
|
||||
];
|
||||
|
||||
public function transaksi(){
|
||||
return $this->hasMany('App\Models\Transaksi','tagihan_id','id');
|
||||
}
|
||||
|
||||
public function role(){
|
||||
return $this->hasMany('App\Models\Role','tagihan_id','id');
|
||||
}
|
||||
|
||||
public function siswa(){
|
||||
return $this->belongsToMany('App\Models\Siswa','role');
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Transaksi extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'transaksi';
|
||||
|
||||
protected $fillable = [
|
||||
'siswa_id',
|
||||
'tagihan_id',
|
||||
'total',
|
||||
'diskon',
|
||||
'is_lunas',
|
||||
'keterangan'
|
||||
];
|
||||
|
||||
public function tagihan(){
|
||||
return $this->hasOne('App\Models\Tagihan','id','tagihan_id');
|
||||
}
|
||||
|
||||
public function siswa(){
|
||||
return $this->hasOne('App\Models\Siswa','id','siswa_id');
|
||||
}
|
||||
|
||||
public function keuangan(){
|
||||
return $this->hasOne('App\Models\Keuangan','transaksi_id','id');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue