0
votes

hello guys am getting Route [member.store] not defined. error in my laravel 5.5 application ****this is the create.blade.php****

<form class="form-horizontal" method="POST" action="{{ route ('member.store') }}">
              {{ csrf_field() }}
                  <div class="control-group">
                    <label class="control-label">First Name</label>
                    <div class="controls">
                      <input type="text" name="first_name" id="required">
                    </div>
                  </div>
                  <div class="control-group">
                    <label class="control-label">Middle Name</label>
                    <div class="controls">
                      <input type="text" name="middle_name" id="required">
                    </div>
                  </div>
                  <div class="control-group">
                    <label class="control-label">Last Name</label>
                    <div class="controls">
                      <input type="text" name="last_name" id="required">
                    </div>
                  </div>
                  <div class="control-group">
                  <label class="control-label">Gender</label>
                  <div class="controls" name="gender">
                    <select >
                      <option>Unknown</option>
                      <option>Male</option>
                      <option>Female</option>

                    </select>
                  </div>
                  </div>
                <div class="control-group">
                  <label class="control-label">Marital Status</label>
                  <div class="controls" name="marital_status">
                    <select >
                      <option>Unknown</option>
                      <option>Single</option>
                      <option>Engaged</option>
                      <option>Married</option>

                    </select>
                  </div>
                </div>
                <div class="control-group">
                  <label class="control-label">Status</label>
                  <div class="controls">
                    <select >
                      <option>Unknown</option>
                      <option>Attender</option>
                      <option>Visitor</option>
                      <option>Inactive</option>

                    </select>
                  </div>
                </div>
                <div class="control-group">
                    <label class="control-label">Mobile Phone</label>
                    <div class="controls">
                      <input type="text" name="required" id="required">
                    </div>
                </div>
                <div class="control-group">
                  <label class="control-label">Your Email</label>
                  <div class="controls">
                    <input type="text" name="email" id="email">
                  </div>
                </div>
                <div class="control-group">
                  <label class="control-label">Date of Birth</label>
                  <div class="controls">
                    <input type="text" name="date" id="date">
                  </div>
                </div>
                  <div class="control-group">
                    <label class="control-label">Address</label>
                    <div class="controls">
                      <input type="text" name="email" id="email">
                    </div>
                  </div>
                  <div class="control-group">
                    <label class="control-label">Photo</label>
                    <div class="controls">
                      <input type="upload" name="photo" id="email">
                    </div>
                  </div>
                  <div class="control-group">
                    <label class="control-label">Description</label>
                    <div class="controls">
                      <input type="text" name="description" id="email">
                    </div>
                  </div>
                  <div class="form-actions">
                    <input type="submit" name="submit" class="btn btn-success">
                  </div>
            </form>

This is the route // Route for member Route::group(['prefix' => 'member'], function () {

Route::post('store', 'MemberController@store');
Route::get('data', 'MemberController@index');
Route::get('create', 'MemberController@create');

}); This is the membercontroller

namespace App\Http\Controllers;

use App\Member; use Illuminate\Http\Request;

class MemberController extends Controller {

public function index()
{
    return view ('member.data');
}


public function create()
{
    return view ('member.create');
}


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


public function show($id)
{
    //
}


public function edit($id)
{
    //
}


public function update(Request $request, $id)
{
    //
}


public function destroy($id)
{
    //
}

} PLease guys really need your help

1
Hey there, please upload just the code that is necessary to help you, so it is easier to read and understand. Also indicate where you are getting that error. CheersDarkCygnus

1 Answers

2
votes

There are 2 ways to do this: one is declare route as resource:

Route::resource("member", "MemberController");

Or:

Route::post('store', 'MemberController@store')->name("member.store");

The first one get automatically the name like "member.store", "member.index", etc. The second one the name that you have declared before at routes.php.