2 months ago

How to get a parameter

Posted 2 months ago by Lestah

on my web.php i have this route

Route::get('test-verification/{id}', function($id) {
    event(new Registered(User::first()));

then on my browser localhost:3000/test-verificatioin/54

i have a VerifyAccount.php

namespace User\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Lang;
use User\Models\User;

class VerifyAccount extends Mailable
    use Queueable, SerializesModels;

     * The User object.
     * @var \User\Models\User
    protected $user;

     * Create a new message instance.
     * @param  \User\Models\User $user
     * @return $this
    public function __construct(User $user)
        $this->user = $user;

     * Build the message.
     * @param  object  $event
     * @param  \User\Models\User $user
     * @return $this
    public function build(User $user)
        $resource = User::where('id', $user)->get();
        //$resource = User::all();
        //return $this->view('preview.report', compact('resource'));
        return $this->view('theme::preview.report')->withUser($this->user);

there's no error but when i dd($user) i failed to the get the parameter i pass on

Please sign in or create an account to participate in this conversation.