Are you actually hitting the store method in that controller? What is your testing server?
Eloquent save() method not saving into DB, no error message, Tinker save() works.
Hello
I am developing on a local machine and deploying to a hosting website. The application and saving into DB works fine on my local machine. However, when I push to the testing server, saving from POST-method form does not work.
I tried with Tinker in Terminal through SSH and saving into DB and creating a Model works on the hosting server, so it is not because of the DB-connection (MySQL).
The form im posting from:
<form method="post" action="/admin/seiten/">
{{ csrf_field() }}
<!-- insert titel of the text -->
<div class="col-lg-10 col-md-10 col-sm-9 col-xs-12">
<input type="text" class="form-control" id="usr" name="title" required>
</div>
<!-- insert text -->
<div class="col-lg-10 col-md-10 col-sm-9 col-xs-12">
<textarea class="form-control" rows="5" id="comment" name="content" required></textarea>
</div>
</form>
Route (with prefix admin):
Route::post('/seiten', 'AdminSeitenController@store');
Controller:
public function store(Request $request)
{
$seite = new Seite;
$seite->titel = $request->input('title');
$seite->inhalt = $request->input('content');
$seite->save();
return Redirect::route('admin.seiten');
}
Has anybody also had same issues and probably a fix for it?
Thanks.
EDIT: dd($seite) also not working...
You have absolute URL in your form
action="/admin/seiten/"
This will only work if your test server has Laravel public folder at the document root. If you are loading the form with a url like /public/admin/sieten then your post will fail
Either way, you should open the network tools in your browser and check what is posted to the server and what the response is
Please or to participate in this conversation.