mardi 18 octobre 2016

Missing required parameters for route

I want to ask how to fix this error. I have this error Missing required parameters for [Route: userprofile.edit] [URI: userprofile/{userprofile}/edit]. (View: C:\xampp\htdocs\code\task1\resources\views\userprofile\create.blade.php)

I have user informations in view userprofile\create.blade.php and after submitting the button I want to relocate the page on the userprofile\edit.blade.php

This is my userProfileController

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\User;

class userProfileController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view("userprofile.create");
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        $user = User::find($id);
        return view('userprofile.edit')->withUser($user);
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}

Also the route for this views

Route::group(['namespace' => 'User'], function(){
 Route::get('/userprofile/{id}/edit', ['as' => 'userprofile.edit', 'uses' => 'userProfileController@edit']);
});


Route::resource('userprofile','userProfileController');

And my route action in the button in create.blade.php

<input type="submit" class="btn btn-primary" action="" value="Edit profile">

If you have any idea why is this error, please write me! Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire