PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 11, 2022

[FIXED] How to display message after registration Laravel Jetstream

 July 11, 2022     authentication, jetstream, laravel, message, php     No comments   

Issue

Hi im trying figure out how to display message(toastr) after successful registration, im using laravel 8 with jetstream authetication, so far i couldnt find anything useful on google... by the way im in RegistredUserController.php

 public function store(Request $request,
                      CreatesNewUsers $creator): RegisterResponse
{
    event(new Registered($user = $creator->create($request->all())));

    $this->guard->login($user);

    return app(RegisterResponse::class);
}

i tried modifying this block of code but nothing is working... Im new on laravel Any suggestions will be much appreciated!


Solution

So i will add answer to myself using Jetstram is pain in the ass, simply i started new project with breeze and i can easy set up toastr messages after registration .

    public function store(Request $request)
{
    $request->validate([
        'first_name' => ['required', 'string', 'max:255'],
        'last_name' => ['required', 'string', 'max:255'],
        'username' => ['required', 'string', 'max:255', 'unique:users'],
        'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
        'is_vendor' => ['required', 'integer', 'max:255'],
        'password' => ['required', 'confirmed', Rules\Password::defaults()],
    ]);

    $user = User::create([
        'first_name' => $request->first_name,
        'last_name' => $request->last_name,
        'username' => $request->username,
        'email' => $request->email,
        'is_vendor' => $request->is_vendor,
        'password' => Hash::make($request->password),
    ]);

    event(new Registered($user));

    //Auth::login($user);
    $notification = array(
        'message' => 'Registration Completed!',
        'alert-type' => 'success'
    );
    return Redirect()->route('login')->with($notification);
    //return redirect(RouteServiceProvider::HOME)->with($notification);
}


Answered By - Arturs
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing