/home/mip/mip/app/Modules/Likod/Models/Developer/Module.php
<?php

namespace QxCMS\Modules\Likod\Models\Developer;

use Illuminate\Database\Eloquent\Model;
use DB;
use File;
class Module extends Model
{
    protected $connection = 'qxcms';
    protected $table = "modules";
    protected $fillable = [
        'title',
        'link_type',
        'page_id',
        'menu_group_id',
        'module_name',
        'module_description',
        'is_parent',
        'has_parent',
        'parent_id',
        'url',
        'uri',
        'icon',
        'target',
        'show_menu',
        'has_read',
        'has_create',
        'has_update',
        'has_delete',
        'has_export',
        'has_import',
        'has_print'
    ];
    protected $appends = ['hashid'];

    /*
     * Model Accessors
     */

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }


    /*
     * Model Mutators
     */
    public function setParentIdAttribute($value)
    {
        if(empty($value)) $this->attributes['parent_id'] = 0;
        else $this->attributes['parent_id'] = $value;
    }
}