httpoz/hook

Package for allowing and monitoring a[pp access.

v0.4.0 2018-03-26 13:15 UTC

This package is auto-updated.

Last update: 2024-11-05 21:28:15 UTC


README

Build Status codecov Total Downloads

Installation

Composer

Add the package to your project via composer.

composer require httpoz/hooks

Publish

Run this to publish the package's migrations

php artisan vendor:publish --provider="HttpOz\Hook\HookServiceProvider"

Middleware

This package comes with ValidateHookMiddleware. You need to add it to your app/Http/Kernel.php.

<?php
/**
 * The application's route middleware.
 *
 * @var array
 */
protected $routeMiddleware = [

    // ...

    'validateHook' => \HttpOz\Hook\Http\Middleware\ValidateHookMiddleware::class,
];

Now you can add this middleware to your routes. You will also need the prefix, you can call it anything you want but the hook id itself should be the second segment in your url.

<?php

// Route group
Route::group(['prefix' => 'hooks/{hook}', 'middleware' => 'validateHook'], function(){
    Route::resource('notification', 'NotificationController');
});