I am trying to add "add comment" section in my Blog project, and now am getting error:
MassAssignmentException in Model.php line 452:
body
Here is my CommentsController:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Post;
use App\Comment;
use App\Http\Requests;
class CommentsController extends Controller
{
public function store(Post $post)
{
Comment::create([
'body' => request('body'),
'post_id' => $post->id
]);
return back();
}
}
I tried to add Protected $fillable for the body field, but still have the same problem.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wxxtqd
via IFTTT
Aucun commentaire:
Enregistrer un commentaire