Randy_Johnson
3 months ago
406
8
General

No understanding of REQUEST!

Posted 3 months ago by Randy_Johnson

On my view:

<form method="POST" action="/store-user">
                                @csrf
                                <div class="form-group">
                                    <label>Name</label>
                                    <input name="name" type="" class="form-control" placeholder="Enter name">
                                </div>
                                <div class="form-group">
                                    <label>Email Address</label>
                                    <input name="email" type="email" class="form-control" placeholder="Enter email">
                                </div>
                                <div class="form-group">
                                    <label>Password</label>
                                    <input name="password" class="form-control" placeholder="Enter password">
                                </div>
                                <div class="form-group">
                                    <label for="exampleFormControlSelect1">Admin</label>
                                    <select name="is_admin" class="form-control">
                                    <option>0</option>
                                    <option>1</option>
                                    </select>
                                    <small class="form-text text-muted">Select 0 for user and 1 for admin level status.</small>
                                </div>
                                <button type="submit" class="btn btn-primary float-right">Create</button>
                            </form>

Route:

Route::post('/store-user', '[email protected]')->middleware('admin');

Controller:

public function store(Request $request)
    {
        return $request->all();
    }

Result:

{"_token":"0EBiLnf8jUQ3i8xsYRCmtdQXt9XalVzSLmUS8wxN"}

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