Adding additional user data on User Module


  • Global Moderator

    @deben

    I have no more suggestions, it seems all okay and i tested events are firing your provider just aren't handling them.
    That would suggest cached list of service providers.

    try php artisan clear-compiled or php artisan module:dump profile



  • @armababy

    Hey,
    I tried from scratch installing new asgardcms and create profile module to add extra fields to User Module. But same thing happens ,Event is not working .

    So can you please give me your working Event Handler file and Providers file for Profile Module.


  • Global Moderator

    @deben

    There you go did clean install then this.

    1. php artisan asgard:module:scaffold (bekesh/UserProfile, Elequent, no entities, no value objects)
    2. Make file Modules/UserProfile/Providers/EventServiceProvider.php
    3. Make file Modules/UserProfile/Events/Handlers/EventHandler.php (make folders Events -> Handlers)
    4. Fill Modules/UserProfile/Events/Handlers/EventHandler.php with this
    5. Fill Modules/UserProfile/Providers/EventServiceProvider.php with this
    6. Add "Modules\\UserProfile\\Providers\\EventServiceProvider" to Modules/UserProfile/module.json in providers array like this
    7. Login to backend and edit admin user, change something (name for example) - outputs this


  • @armababy

    Ok Cool, this was working fine for Update users. But when am trying to register new user "UserHasRegistered " event not working. Which event should I used for register new user? Is there any other event ? Can you please try with register new user and check event is working for you or not.


  • Global Moderator



  • @armababy

    Hey,
    I got registered user id using UserHasaRegistered event and stored on profile__profiles table. But why the additional fields like about_user,designation are not storing on profile__profiles table. How can I debug this? In the documentation you have specified input name syntax as profile[your-field-name]. Am I doing anything wrong? Following are the two fields on create user view.(from backend new user registration).

          <div class="form-group{{ $errors->has('profile.designation') ? ' has-error has-feedback' : '' }}">
         {!! Form::label('profile[designation]', trans('profile::profiles.form.designation')) !!}
       <input class="form-control" placeholder="{{ trans('profile::profiles.form.designation') }}"
                                   name="profile[designation]" type="text" id="profile[designation]" value="{{ Input::old('profile.designation') }}">
        {!! $errors->first('<profile class="designation"></profile>', '<span class="help-block">:message</span>') !!}
        </div>
    
       <div class="form-group{{ $errors->has('profile.about_user') ? ' has-error has-feedback' : '' }}">
    {!! Form::label('profile[about_user]', trans('profile::profiles.form.about user')) !!}
    
    <textarea cols="20" rows="3" class="form-control" placeholder="{{ trans('profile::profiles.form.about user') }}" name="profile[about_user]" type="text" id="profile[about_user]" value="{{ Input::old('profile.about_user') }}"></textarea>
    
    {!! $errors->first('profile.about_user', '<span class="help-block">:message</span>') !!}
      </div>


  • @nWidart @armababy

    Hey,

    I am waiting for your response . I got stuck.


  • Global Moderator

    @deben

    I currently don't have much time to test out your code :(
    I'll post here when and if i do.



  • @armababy

    Did you get a chance to look into my code?



  • hi @deben, you did work this issue can put addional data on profile user ?


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.