Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
marktopper committed Aug 22, 2017
0 parents commit df6729f
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
19 changes: 19 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "test-hook",
"description": "This is my first hook.",
"require": {
"larapack/hooks": "~1.0"
},
"autoload": {
"psr-4": {
"TestHook\\": "src/"
}
},
"extra": {
"hook": {
"providers": [
"TestHook\\TestHookServiceProvider"
]
}
}
}
46 changes: 46 additions & 0 deletions src/TestHookServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace TestHook;

use Illuminate\Events\Dispatcher;
use Illuminate\Support\ServiceProvider;

class TestHookServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}

/**
* Register any application services.
*
* @return void
*/
public function register()
{
// Add routers
app('router')->get('test', function () {
return 'Hello world!';
});

// Add routes with Voyager's prefix (group)
app(Dispatcher::class)->listen('voyager.admin.routing', function ($router) {
$router->get('test', function () {
return 'Hello possibly not-logged-in user!';
});
});

// Add routes behind Voyager authentication
app(Dispatcher::class)->listen('voyager.admin.routing', function ($router) {
$router->get('test-with-login', function () {
return 'Hello logged-in user!';
})->name('test');
});
}
}

0 comments on commit df6729f

Please sign in to comment.