protected function saving(Eloquent $role, $input = [], $type = 'create')
    {
        $beforeEvent = ($type === 'create' ? 'creating' : 'updating');
        $afterEvent  = ($type === 'create' ? 'created' : 'updated');

        $name = $input['name'];
        $role->fill([
            'name'        => snake_case($name, '-'),
            'full_name'   => $name,
            'area'        => array_get($input, 'area'),
            'description' => $input['description']
        ]);
        if (!$role->exists && isset($input['roles'])) {
            $role->parent_id = $input['roles'];
        }
        $this->fireEvent($beforeEvent, [$role]);
        $this->fireEvent('saving', [$role]);
        DB::transaction(function() use($role, $input) {
            $role->save();
            $this->import($input, $role);
        });
        $this->fireEvent($afterEvent, [$role]);
        $this->fireEvent('saved', [$role]);

        return true;
    }
protected function saving(Eloquent $role, $input = [], $type = 'create')
    {
        $beforeEvent = ($type === 'create' ? 'creating' : 'updating');
        $afterEvent  = ($type === 'create' ? 'created' : 'updated');

        $name = $input['name'];
        $role->fill([
            'name'        => snake_case($name, '-'),
            'full_name'   => $name,
            'area'        => array_get($input, 'area'),
            'description' => $input['description']
        ]);
        if (!$role->exists && isset($input['roles'])) {
            $role->parent_id = $input['roles'];
        }
        $this->fireEvent($beforeEvent, [$role]);
        $this->fireEvent('saving', [$role]);
        DB::transaction(function() use($role, $input) {
            $role->save();
            $this->import($input, $role);
        });
        $this->fireEvent($afterEvent, [$role]);
        $this->fireEvent('saved', [$role]);

        return true;
    }
protected function saving ( Eloquent $ role , $ input = [ ] , $ type = 'create' ) { $ beforeEvent = ( $ type === 'create' ? 'creating' : 'updating' ) ; $ afterEvent = ( $ type === 'create' ? 'created' : 'updated' ) ; $ name = $ input [ 'name' ] ; $ role -> fill ( [ 'name' => snake_case ( $ name , '-' ) , 'full_name' => $ name , 'area' => array_get ( $ input , 'area' ) , 'description' => $ input [ 'description' ] ] ) ; if ( ! $ role -> exists && isset ( $ input [ 'roles' ] ) ) { $ role -> parent_id = $ input [ 'roles' ] ; } $ this -> fireEvent ( $ beforeEvent , [ $ role ] ) ; $ this -> fireEvent ( 'saving' , [ $ role ] ) ; DB :: transaction ( function ( ) use ( $ role , $ input ) { $ role -> save ( ) ; $ this -> import ( $ input , $ role ) ; } ) ; $ this -> fireEvent ( $ afterEvent , [ $ role ] ) ; $ this -> fireEvent ( 'saved' , [ $ role ] ) ; return true ; }
Save the role.

@param  \Antares\Model\Role  $role
@param  array  $input
@param  string  $type

@return bool
Save the role .