|
@@ -11,9 +11,16 @@
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
+// Cannot cache a view result as such, as it contains a Closure, which is
|
|
|
+// not serializable.
|
|
|
+
|
|
|
$this->get('/tasks', function () {
|
|
|
- return Cache::remember('all-tasks', 1, function () {
|
|
|
- $tasks = \App\Task::all();
|
|
|
- return $tasks;
|
|
|
- });
|
|
|
-});
|
|
|
+ $tasks = \App\Task::all();
|
|
|
+ return view('welcome', compact('tasks'))->__toString();
|
|
|
+})->middleware('cache');
|
|
|
+
|
|
|
+$this->get('/tasks/first', function () {
|
|
|
+ $tasks = [\App\Task::first()];
|
|
|
+ return view('welcome', compact('tasks'))->__toString();
|
|
|
+})->middleware('cache');
|
|
|
+
|