Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Laravel 4 Basics Blade & Forms Form Builder

"The Page Has Expired Due to inactivity" Error

I'm new with Laravel, I am now using the latest version 5.6. Despite the version difference on this video I was able to work my way up to the Form Builder part of the course. I was working on:

the create.blade.php file with this code:

@extends('layouts.main') @section('content') <form method="POST" action="http://laravel.test/todos" accept-charset="UTF-8"> <label for="title">List Title</label> <input name="title" type="text" id="title"> <input class="button" type="submit" value="submit"> </form>

@stop

and TodoListController.php code

public function create() { return View('todos.create'); }

public function store() 
{
    return "Creating a New List";
    //$list = new TodoList();
    //$list->name = "Another List";
    //$list->save();
}

However when I run the site I get a "The Page Has Expired Due to inactivity" Error.

Can anybody tell me what I'm doing wrong?

Thanks

1 Answer

In your firm in the HTML file add a line which says:

@csrf

This will probably fix it. The error is one I struggled with and it was due to the missing csrf token.