I faced strange behavior of laravel, sometimes my form submitted data into database next time I tried it did not work anymore, instead of sending into db, it shows in the address bar of browser something like I got the data sent with GET method like this localhost/Sites/Laravel/MyApp/public/frontend/pages/enrolment/course/create?_token=PHtHVARpK9SIGuQq9280CX5c48WvQ16aQOKcxUSn&name=Alex+Perrington&secnumber=11111151019728
Could you please point me what possibly wrong. Thanks Here is the code
//Model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class Course extends Model{
protected $fillable = ['name','secnumber'];
}
//Controller, Here I use Static Request
.
.
use Request;
.
.
.
public function store(Request $request){
$c = new Course;
$c->name = Request::input('name');
$c->secnumber = Request::input('secnumber');
$c->save();
return redirect('/home');
}
//Form
<form style="margin-bottom:10px;">
{!! Form::open(['url' => '/frontend/pages/enrolment/course/store', 'method'=>'POST', 'files'=>'true']) !!}
<div class="form-group">
{!! Form::label('name', 'Name:') !!}
{!! Form::text('name',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('secnumber', 'Sec ID:') !!}
{!! Form::text('secnumber',null,['class'=>'form-control']) !!}
</div>
{!! Form::submit('Create Information', ['class' => 'btn btn-success']) !!}
{!! Form::reset('Batal', ['class' => 'btn btn-danger']) !!}
{!! Form::close() !!}
</form>
//Route
Route::post('frontend/pages/enrolment/course/store','CourseController@store');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire