1
Good afternoon I am trying at all costs to make an Internet in the bank, using the Laravel and Controller, however, it does not work at all, I have tried everything that is way, migrating, changing screen name, anyway, all the ways and nothing. On 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 called posts with an auto id incremento not null, a field called varchar 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 passed 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?
If your answer is sufficient to solve the author’s problem, if possible, elaborate your answer better.
– Bruno Augusto
I edited and explained in more detail
– SOSTheBlack