3

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

Abenslive
  • 105
  • 1
  • 1
  • 11

4 Answers4

3

I got it working using the documentation Query String

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

You can do:

HTTP Requests

use Illuminate\Http\Request;

$type = $request->input('type');

Helper Request Method

$type = request('type');
Digvijay
  • 7,836
  • 3
  • 32
  • 53
-1

I don't know livewire, but it's looks like laravel. Just try

Input::query('type')
zimrob
  • 19
  • 1