<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class AccountHead extends Model { protected $table = "acc_head"; protected $guarded=['id']; function acc_type() { return $this->belongsTo('App\Models\AccountType','type_id'); } function debited() { return $this->hasMany('App\Models\Journal','debit_account'); } function credited() { return $this->hasMany('App\Models\Journal','credit_account'); } function children() { return $this->hasMany('App\Models\AccountHead','parent_head'); } }