AccountHead.php 599 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class AccountHead extends Model
  5. {
  6. protected $table = "acc_head";
  7. protected $guarded=['id'];
  8. function acc_type()
  9. {
  10. return $this->belongsTo('App\Models\AccountType','type_id');
  11. }
  12. function debited()
  13. {
  14. return $this->hasMany('App\Models\Journal','debit_account');
  15. }
  16. function credited()
  17. {
  18. return $this->hasMany('App\Models\Journal','credit_account');
  19. }
  20. function children()
  21. {
  22. return $this->hasMany('App\Models\AccountHead','parent_head');
  23. }
  24. }