Laravel 5 Mass Assignment error


I am learning laravel 5 framework and i am trying to update a record using a form.

In my article controller I have this:

namespace App\Http\Controllers;

use Illuminate\Http\Request;// shortcut used => use Request;

use App\Article;
use App\Http\Requests;
use App\Http\Controllers\Controller;
//use Request;

class ArticlesController extends Controller
    public function index()
        //return 'get all articles';
        //$articles = Article::order_by('created_at', 'desc')->get();// -nu merge
       // $articles = Article::latest('created_at')->get();
        $articles = Article::latest('created_at')->published()->get();
        //return $articles;
       // return view('articles.index')->with('articles',$articles);
        return view('articles.index', compact('articles'));
    public function show($id)

        return view('', compact('article'));
        //return $article;
        //return $id;
    public function create()

        return view('articles.create');
    public function store(Requests\CreateArticleRequest $request)

        $input = Request::all();
        $article = new Article;
        $article->title = $input['title'];
        $article->body = $input['body'];
        $article->publish_at = $input['publish_at'];
        return redirect ('admin/articles');
    public function edit($id)

        $article = Article::findOrFail($id);
        return view ('articles.edit', compact('article'));
    public function update($id, Request $request)

       $article = Article::findOrFail($id);
        return redirect ('admin/articles');

Open in new window

When I am trying to update (update method) I receive the following error

MassAssignmentException in Model.php line 424:
in Model.php line 424
at Model->fill(array('_method' => 'PATCH', '_token' => 'kNo1s676a5jUvGG0z52FjUB5LJWefQfR2jZREQr8', 'title' => 'ewrwere', 'body' => '12334cffff', 'publish_at' => '2015-11-15')) in Model.php line 1454
at Model->update(array('_method' => 'PATCH', '_token' => 'kNo1s676a5jUvGG0z52FjUB5LJWefQfR2jZREQr8', 'title' => 'ewrwere', 'body' => '12334cffff', 'publish_at' => '2015-11-15')) in ArticlesController.php line 76

I you have any ideas please help me.
Thank you,
Qw MAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
By default, Eloquent models protect against mass-assignment.  If you want to make parts of the model open to mass assignment, you can do that at the time you create the model.  You use $guarded and $fillable (these are arrays of column names) to specify blacklists and whitelists.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.