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

        $user->firstname = $input['firstname'];
        $user->lastname  = $input['lastname'];
        $user->email     = $input['email'];

        if (isset($input['status'])) {
            $user->status = $input['status'];
        }
        if ($user->exists && !isset($input['status'])) {
            $user->status = 0;
        }

        $this->fireEvent($beforeEvent, [$user]);
        $this->fireEvent('saving', [$user]);

        DB::transaction(function () use ($user, $input) {
            $user->save();
            $user->roles()->sync($input['roles']);
        });

        $this->fireEvent($afterEvent, [$user]);
        $this->fireEvent('saved', [$user]);

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

        $user->firstname = $input['firstname'];
        $user->lastname  = $input['lastname'];
        $user->email     = $input['email'];

        if (isset($input['status'])) {
            $user->status = $input['status'];
        }
        if ($user->exists && !isset($input['status'])) {
            $user->status = 0;
        }

        $this->fireEvent($beforeEvent, [$user]);
        $this->fireEvent('saving', [$user]);

        DB::transaction(function () use ($user, $input) {
            $user->save();
            $user->roles()->sync($input['roles']);
        });

        $this->fireEvent($afterEvent, [$user]);
        $this->fireEvent('saved', [$user]);

        return true;
    }
protected function saving ( Eloquent $ user , $ input = [ ] , $ type = 'create' ) { $ beforeEvent = ( $ type === 'create' ? 'creating' : 'updating' ) ; $ afterEvent = ( $ type === 'create' ? 'created' : 'updated' ) ; $ user -> firstname = $ input [ 'firstname' ] ; $ user -> lastname = $ input [ 'lastname' ] ; $ user -> email = $ input [ 'email' ] ; if ( isset ( $ input [ 'status' ] ) ) { $ user -> status = $ input [ 'status' ] ; } if ( $ user -> exists && ! isset ( $ input [ 'status' ] ) ) { $ user -> status = 0 ; } $ this -> fireEvent ( $ beforeEvent , [ $ user ] ) ; $ this -> fireEvent ( 'saving' , [ $ user ] ) ; DB :: transaction ( function ( ) use ( $ user , $ input ) { $ user -> save ( ) ; $ user -> roles ( ) -> sync ( $ input [ 'roles' ] ) ; } ) ; $ this -> fireEvent ( $ afterEvent , [ $ user ] ) ; $ this -> fireEvent ( 'saved' , [ $ user ] ) ; return true ; }
Save the user.

@param  \Antares\Model\User  $user
@param  array  $input
@param  string  $type

@return bool
Save the user .