I am using laravel 5.5 when ever i send data in post request to my controller . It always show the following message The page has expired due to inactivity.
Please refresh and try again. my view code is :
@extends('layouts.app')
@section('content')
<!DOCTYPE html>
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<title></title>
</head>
<body>
<div class="span3 well">
<legend>Create Your New Task!</legend>
<div class="form-group">
<div class="col-md-4">
<form accept-charset="UTF-8" action="/add-task" class="form-horizontal" method="post">
<input class="form-control" name="name" placeholder="Task Name" type="text">
<input class="form-control" name="assignedto" placeholder="Assigned To" type="text">
<input class="form-control" name="deadline" placeholder="DeadLine" type="text">
<button class="btn btn-warning" type="submit">Add Task</button>
{{csrf_field()}}
</form>
</div>
</div>
</div>
</body>
</html>
@endsection()
and my controller is :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\task;
class AddTask extends Controller
{
public function insertTask(Request $req)
{
$name=new task();
$name->name=$req['name'];
$name->assigned_to=$req['assignedto'];
$name->deadline=$req['deadline'];
$name->save();
}
}
i doen't know what is the solution