public function afterCreate()
    {
        //create company
        $company = new Companies();
        $company->name = $this->defaultCompanyName;
        $company->users_id = $this->getId();
        if (!$company->save()) {
            throw new Exception(current($company->getMessages()));
        }

        $this->default_company = $company->getId();

        if (!$this->update()) {
            throw new Exception(current($this->getMessages()));
        }
    }
public function afterCreate()
    {
        //create company
        $company = new Companies();
        $company->name = $this->defaultCompanyName;
        $company->users_id = $this->getId();
        if (!$company->save()) {
            throw new Exception(current($company->getMessages()));
        }

        $this->default_company = $company->getId();

        if (!$this->update()) {
            throw new Exception(current($this->getMessages()));
        }
    }
public function afterCreate ( ) { //create company $ company = new Companies ( ) ; $ company -> name = $ this -> defaultCompanyName ; $ company -> users_id = $ this -> getId ( ) ; if ( ! $ company -> save ( ) ) { throw new Exception ( current ( $ company -> getMessages ( ) ) ) ; } $ this -> default_company = $ company -> getId ( ) ; if ( ! $ this -> update ( ) ) { throw new Exception ( current ( $ this -> getMessages ( ) ) ) ; } }
What to do after the creation of a new users
- Company
- add notification for this user

@return void
What to do after the creation of a new users - Company - add notification for this user