php - GET input method isn't logging data into Laravel application -
trying create simple input method. db table (comments) contains increment "id", varchar(30) "name", , text "comments".
a url such app.local/comments?name=john&comments=test how input data application.
my route entry:
route::get('comments', 'commentscontroller@index');
my comments controller:
<?php class commentscontroller extends \basecontroller { public function index() { $name = input::get('name'); $comments = input::get('comments'); } }
my comments model:
<?php class comments extends eloquent { protected $table = 'comments'; }
after several variations , no errors can not data table. advice? thank in advance.
it's because not persist data, need instantiate new model, save
it:
$comment = new comments; $comment->name = input::get('name'); $comment->comments = input::get('comments'); $comment->save();
i recommend learn more eloquent
Comments
Post a Comment