My database is working fine with my laravel application but while i was trying to insert data to my database i am facing a error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into
articles(
article_head,
article_body,
updated_at,
created_at) values (, , 2016-04-27 18:40:58, 2016-04-27 18:40:58))
My view file
`<form method="post" action="">
{!! csrf_field() !!}
<div class="form-group">
<label for="write_heading">Write Heading:</label>
<textarea class="form-control" rows="3" cols="10" id="write_heading" name="article_head" style="resize: none;"></textarea>
<label for="write_post">Write Post:</label>
<textarea class="form-control" rows="15" cols="10" id="write_post" name="article_body" placeholder="write something awesome!!" style="resize: none;"></textarea>
<br>
<div class="model-footer">
<button type='submit' class='btn btn-primary create_button'>Create</button>
<button type='reset' class='btn btn-default reset_button'>Reset</button>
<button type="button" class="btn btn-danger close_button" data-dismiss="modal">Close</button>
</div>
</div>
</form>
`
my controller code
`class ArticleEditor extends Controller
{
//insert article to database
public function insert_article(Request $request) {
$Article = new article;
$Article->article_head = $request->article_head;
$Article->article_body = $request->article_body;
$Article->save();
return redirect('/dashboard');
}
}
`
Migration file
` public function up()
{
Schema::create('articles', function(Blueprint $table)
{
$table->increments('article_id');
$table->string('article_head', 500);
$table->string('article_body', 10000);
$table->dateTime('created_on');
});
}`
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire