deladels
3733
1
Laravel

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message

Posted 1 year ago by deladels

i am trying to post data to my database. on submission of the form i get the error and i can seem to figure it out:

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message

this is my route:

Route::post('/addBus', '[email protected]');

my model:

namespace App;

use Illuminate\Database\Eloquent\Model;

class AddBus extends Model {

protected $fillable = [ 'reg_number', 'model', 'capacity' ];

}

controller:

namespace App\Http\Controllers;

use App\Http\Controllers\Controllers;

use Illuminate\Http\Request;

use App\AddBus;

class BusesController extends Controller { //metthod to store buses public function store(){

    $this->validate( request(), [

        'busRegNo'  => 'required',
        'busModel'  => 'required',
        'capacity'  => 'required'

    ]);

    dd(request()->all());

    AddBus::create([

    'reg_number'  => request('busRegNo'),
    'model'       => request('busModel'),
    'capacity'    => request('capacity')

]);

return back();
}

}

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