Good afternoon I'm trying at all costs to make an insert in the bank, using Laravel and Controller, however, it does not work at all, I've tried everything that is shape, doing migrate, changing screen name, anyway, in any way and nothing. In my rote, I have this code:
Route::when('*', 'csrf', array('post'));
Route::get('/', 'HomeController@getIndex');
Route::post('save', 'HomeController@postAddUser');
Route::post('login', 'HomeController@postLogin');
Route::group(array('before' => 'auth'), function(){
Route::controller('profile', 'ProfilesController');
});
In my Controller, I have the following action:
public function postInserir(){
$posts = new Post();
$posts->nome = Auth::user()->nome;
$posts->post = Input::get('text_post');
$posts->save();
return Redirect::to('/');
}
Model:
class Post extends Eloquent{
}
In my database, I have a table named posts with an auto increment id not null, a field named varchar name 255 not null and a field called post longtext
And this is my View:
<?php echo Form::open(array('action' => 'ProfilesController@postInserir', 'role' => 'form', 'id' => 'post-form')); ?>
<div class="panel-body">
<textarea id="text_post" name="text_post" class="form-control" rows="2"></textarea>
</div>
<div class="panel-footer" style="background-color: black;">
<button type="submit" id="publicar" class="btn btn-primary btn-xs pull-right">Publicar</button>
<?php echo Form::close(); ?>
If I submit the form, it goes up to the action, it displays what was last and everything else, the problem and when I do I call the $ posts-> save () method, which gives me the message "Whoops , looks .. "
Does anyone know where the problem might be?