Search code examples
phplaravelcomponentslaravel-livewirelivewires

Get type parameter value from URL with livewire


I wanted to get the value of type from the url "example.com/user?type=agent" using livewire.

I have tried using Input::get('type') but is not working in livewire component class


Solution

  • This is the example you can try:
    
            public $type;
            protected $queryString = ['type'];
            
            return view('bladefile',[
                        'posts' => Post::where('title', 'like', '%'.$this->type.'%')->get(),
                    ]);
              }