Skip to content

Commit

Permalink
Move closure routes to controller methods to allow caching routes
Browse files Browse the repository at this point in the history
  • Loading branch information
alextime committed Feb 13, 2019
1 parent d6d3905 commit 88aaa6e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
8 changes: 2 additions & 6 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
], function () {

// Mercurius home
Route::get('/messages', function () {
return View('mercurius::mercurius');
})->name('home');
Route::get('/messages', ['as' => 'home', 'uses' => 'MessagesController@index']);

// User Profile
Route::get('/profile/refresh', 'ProfileController@refresh');
Expand All @@ -42,7 +40,5 @@
Route::post('/receivers', 'ReceiversController@search');

// Dummy page example
Route::get('/notification-page-sample', function () {
return View('mercurius::example');
})->name('example');
Route::get('/notification-page-sample', ['as' => 'example', 'uses' => 'PagesController@notificationPageSample']);
});
10 changes: 10 additions & 0 deletions src/Http/Controllers/MessagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ public function __construct()
$this->middleware('auth');
}

/**
* Index all messages
*
* @return mixed
*/
public function index()
{
return View('mercurius::mercurius');
}

/**
* Send a message from the current user.
*
Expand Down
27 changes: 27 additions & 0 deletions src/Http/Controllers/PagesController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Launcher\Mercurius\Http\Controllers;

class PagesController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}

/**
* Index all messages
*
* @return mixed
*/
public function notificationPageSample()
{
return View('mercurius::example');
}

}

0 comments on commit 88aaa6e

Please sign in to comment.