├── .all-contributorsrc
├── .env.travis
├── .github
└── FUNDING.yml
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── composer.json
├── phpunit.xml
├── src
├── App
│ ├── Http
│ │ ├── Controllers
│ │ │ ├── LaravelBlockerController.php
│ │ │ └── LaravelBlockerDeletedController.php
│ │ ├── Middleware
│ │ │ └── LaravelBlocker.php
│ │ └── Requests
│ │ │ ├── SearchBlockerRequest.php
│ │ │ ├── StoreBlockerRequest.php
│ │ │ └── UpdateBlockerRequest.php
│ ├── Models
│ │ ├── BlockedItem.php
│ │ └── BlockedType.php
│ ├── Rules
│ │ └── UniqueBlockerItemValueEmail.php
│ └── Traits
│ │ ├── IpAddressDetails.php
│ │ └── LaravelCheckBlockedTrait.php
├── Database
│ ├── Migrations
│ │ ├── 2019_02_19_032636_create_laravel_blocker_types_table.php
│ │ └── 2019_02_19_045158_create_laravel_blocker_table.php
│ └── Seeders
│ │ ├── DefaultBlockedItemsTableSeeder.php
│ │ ├── DefaultBlockedTypeTableSeeder.php
│ │ └── publish
│ │ ├── BlockedItemsTableSeeder.php
│ │ └── BlockedTypeTableSeeder.php
├── LaravelBlockerFacade.php
├── LaravelBlockerServiceProvider.php
├── config
│ └── laravelblocker.php
├── resources
│ ├── lang
│ │ └── en
│ │ │ └── laravelblocker.php
│ └── views
│ │ ├── forms
│ │ ├── create-new.blade.php
│ │ ├── delete-full.blade.php
│ │ ├── delete-item.blade.php
│ │ ├── delete-sm.blade.php
│ │ ├── destroy-all.blade.php
│ │ ├── destroy-full.blade.php
│ │ ├── destroy-sm.blade.php
│ │ ├── edit-form.blade.php
│ │ ├── partials
│ │ │ ├── item-blocked-user-select.blade.php
│ │ │ ├── item-note-input.blade.php
│ │ │ ├── item-type-select.blade.php
│ │ │ └── item-value-input.blade.php
│ │ ├── restore-all.blade.php
│ │ ├── restore-item.blade.php
│ │ └── search-blocked.blade.php
│ │ ├── laravelblocker
│ │ ├── create.blade.php
│ │ ├── deleted
│ │ │ └── index.blade.php
│ │ ├── edit.blade.php
│ │ ├── index.blade.php
│ │ └── show.blade.php
│ │ ├── modals
│ │ └── confirm-modal.blade.php
│ │ ├── partials
│ │ ├── blocked-items-table.blade.php
│ │ ├── bs-visibility-css.blade.php
│ │ ├── flash-messages.blade.php
│ │ ├── form-status.blade.php
│ │ └── styles.blade.php
│ │ └── scripts
│ │ ├── blocked-form.blade.php
│ │ ├── confirm-modal.blade.php
│ │ ├── datatables.blade.php
│ │ ├── search-blocked.blade.php
│ │ └── tooltips.blade.php
└── routes
│ └── web.php
└── tests
└── TestCase.php
/.all-contributorsrc:
--------------------------------------------------------------------------------
1 | {
2 | "projectName": "laravel-blocker",
3 | "projectOwner": "jeremykenedy",
4 | "repoType": "github",
5 | "repoHost": "https://github.com",
6 | "files": [
7 | "README.md"
8 | ],
9 | "imageSize": 100,
10 | "commit": false,
11 | "contributors": [
12 | {
13 | "login": "jeremykenedy",
14 | "name": "Jeremy Kenedy",
15 | "avatar_url": "https://avatars0.githubusercontent.com/u/6244570?v=4",
16 | "profile": "http://jeremykenedy.github.io/",
17 | "contributions": [
18 | "code"
19 | ]
20 | }
21 | ],
22 | "contributorsPerLine": 7
23 | }
24 |
--------------------------------------------------------------------------------
/.env.travis:
--------------------------------------------------------------------------------
1 | APP_NAME=Laravel
2 | APP_ENV=testing
3 | APP_KEY=
4 | APP_DEBUG=true
5 | APP_LOG_LEVEL=debug
6 | APP_URL=http://localhost
7 |
8 | DB_CONNECTION=mysql
9 | DB_HOST=127.0.0.1
10 | DB_PORT=3306
11 | DB_DATABASE=laravelblocker
12 | DB_USERNAME=root
13 | DB_PASSWORD=
14 |
15 | BROADCAST_DRIVER=log
16 | CACHE_DRIVER=array
17 | SESSION_DRIVER=file
18 | SESSION_LIFETIME=120
19 | QUEUE_DRIVER=sync
20 |
21 | REDIS_HOST=127.0.0.1
22 | REDIS_PASSWORD=null
23 | REDIS_PORT=6379
24 |
25 | MAIL_DRIVER=smtp
26 | MAIL_HOST=smtp.mailtrap.io
27 | MAIL_PORT=2525
28 | MAIL_USERNAME=null
29 | MAIL_PASSWORD=null
30 | MAIL_ENCRYPTION=null
31 |
32 | PUSHER_APP_ID=
33 | PUSHER_APP_KEY=
34 | PUSHER_APP_SECRET=
35 | PUSHER_APP_CLUSTER=mt1
36 |
37 | # Laravel Blocker Core Setting
38 | LARAVEL_BLOCKER_ENABLED=true
39 |
40 | # Laravel Blocker Database Settings
41 | LARAVEL_BLOCKER_DATABASE_CONNECTION='mysql'
42 | LARAVEL_BLOCKER_DATABASE_TABLE='laravel_blocker'
43 | LARAVEL_BLOCKER_TYPE_DATABASE_TABLE='laravel_blocker_types'
44 | LARAVEL_BLOCKER_SEED_DEFAULT_TYPES=true
45 | LARAVEL_BLOCKER_SEED_DEFAULT_ITEMS=true
46 | LARAVEL_BLOCKER_TYPES_SEED_PUBLISHED=true
47 | LARAVEL_BLOCKER_ITEMS_SEED_PUBLISHED=true
48 | LARAVEL_BLOCKER_USE_TYPES_SEED_PUBLISHED=true
49 | LARAVEL_BLOCKER_USE_ITEMS_SEED_PUBLISHED=true
50 |
51 | # Laravel Blocker Front End Settings
52 | LARAVEL_BLOCKER_BLADE_EXTENDED='layouts.app'
53 | LARAVEL_BLOCKER_TITLE_EXTENDED='template_title'
54 | LARAVEL_BLOCKER_BOOTSTRAP_VERSION='4'
55 | LARAVEL_BLOCKER_CARD_CLASSES=''
56 | LARAVEL_BLOCKER_BLADE_PLACEMENT='yield'
57 | LARAVEL_BLOCKER_BLADE_PLACEMENT_CSS='template_linked_css'
58 | LARAVEL_BLOCKER_BLADE_PLACEMENT_JS='footer_scripts'
59 | LARAVEL_BLOCKER_JQUERY_CDN_ENABLED=true
60 | LARAVEL_BLOCKER_JQUERY_CDN_URL='https://code.jquery.com/jquery-3.2.1.slim.min.js'
61 | LARAVEL_BLOCKER_FONT_AWESOME_CDN_ENABLED=true
62 | LARAVEL_BLOCKER_FONT_AWESOME_CDN_URL='https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'
63 | LARAVEL_BLOCKER_TOOLTIPS_ENABLED=true
64 | LARAVEL_BLOCKER_JQUERY_IP_MASK_ENABLED=true
65 | LARAVEL_BLOCKER_JQUERY_IP_MASK_CDN='https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.js'
66 | LARAVEL_BLOCKER_FLASH_MESSAGES_ENABLED=true
67 | LARAVEL_BLOCKER_SEARCH_ENABLED=true
68 |
69 | # Laravel Blocker Auth & Roles Settings
70 | LARAVEL_BLOCKER_AUTH_ENABLED=true
71 | LARAVEL_BLOCKER_ROLES_ENABLED=false
72 | LARAVEL_BLOCKER_ROLES_MIDDLWARE='role:admin'
73 |
74 | # Laravel Blocker Pagination Settings
75 | LARAVEL_BLOCKER_PAGINATION_ENABLED=false
76 | LARAVEL_BLOCKER_PAGINATION_PER_PAGE=25
77 |
78 | # Laravel Blocker Databales Settings - Not recommended with pagination.
79 | LARAVEL_BLOCKER_DATATABLES_ENABLED=false
80 | LARAVEL_BLOCKER_DATATABLES_JS_ENABLED=false
81 | LARAVEL_BLOCKER_DATATABLES_JS_START_COUNT=25
82 | LARAVEL_BLOCKER_DATATABLES_CSS_CDN='https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css'
83 | LARAVEL_BLOCKER_DATATABLES_JS_CDN='https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js'
84 | LARAVEL_BLOCKER_DATATABLES_JS_PRESET_CDN='https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js'
85 |
86 | # Laravel Blocker Actions Options
87 | LARAVEL_BLOCKER_DEFAULT_ACTION='abort'
88 | LARAVEL_BLOCKER_DEFAULT_ACTION_ABORT_TYPE='403'
89 | LARAVEL_BLOCKER_DEFAULT_ACTION_VIEW='welcome'
90 | LARAVEL_BLOCKER_DEFAULT_ACTION_REDIRECT='/'
91 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [jeremykenedy]
4 | patreon: jeremykenedy
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ### OSX Vendor Configs ###
2 | .DS_Store
3 | *._DS_Store
4 | ._.DS_Store
5 | *._
6 | ._*
7 | ._.*
8 |
9 | ### Windows Vendor Configs ###
10 | Thumbs.db
11 |
12 | ### Sass ###
13 | #bower_components/*
14 | /.sass-cache/*
15 | .sass-cache
16 |
17 | ### Sublimt Text Vendor Configs ###
18 | *.sublime-workspace
19 |
20 | ### PHP Storm Vendor Configs ###
21 | .idea/*
22 | /.idea/*
23 | .phpintel/*
24 | /.phpintel/*
25 |
26 | ### VS Code Vendor Configs ###
27 | /.vscode
28 |
29 | ### Vagrant/Homestead Vendor Configs ###
30 | /.vagrant
31 | Homestead.yaml
32 | Homestead.json
33 |
34 | ### Master Configs ###
35 | .env
36 | composer.lock
37 |
38 | ### Assets ###
39 | /node_modules
40 | /public/hot
41 | /public/storage
42 | /storage/*.key
43 | /vendor
44 | /storage/debugbar
45 | /storage/framework
46 | /storage/logs
47 | /storage/users
48 | packages/
49 |
50 | # Debug Files
51 | npm-debug.log
52 | yarn-error.log
53 |
54 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | sudo: required
3 | dist: trusty
4 | group: edge
5 |
6 | php:
7 | - 8.2
8 | - 8.3
9 |
10 | sudo: false
11 |
12 | services:
13 | - mysql
14 |
15 | before_script:
16 | - mysql -u root -e 'create database laravelblocker;'
17 | - curl -s http://getcomposer.org/installer | php
18 | - php composer.phar install
19 | - composer create-project --prefer-dist laravel/laravel laravelblocker
20 | - cp .env.travis laravelblocker/.env
21 | - cd laravelblocker
22 | - composer self-update
23 | - composer install --prefer-source --no-interaction
24 | - composer dump-autoload
25 | - composer require jeremykenedy/laravel-blocker
26 | - php artisan key:generate
27 | - php artisan vendor:publish --provider="jeremykenedy\LaravelBlocker\LaravelBlockerServiceProvider"
28 | - composer require laravel/ui --dev
29 | - composer dump-autoload
30 | - php artisan clear-compiled
31 | - sudo chgrp -R www-data storage bootstrap/cache
32 | - sudo chmod -R ug+rwx storage bootstrap/cache
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2020 - 2023 jeremykenedy
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Laravel Blocker
4 |
5 | [](https://packagist.org/packages/jeremykenedy/laravel-blocker)
6 | [](https://packagist.org/packages/jeremykenedy/laravel-blocker)
7 | [](https://travis-ci.org/jeremykenedy/laravel-blocker)
8 | [](https://github.styleci.io/repos/171390607)
9 | [](https://scrutinizer-ci.com/g/jeremykenedy/laravel-blocker/build-status/master)
10 | [](https://scrutinizer-ci.com/g/jeremykenedy/laravel-blocker/?branch=master)
11 | [](https://packagist.org/packages/jeremykenedy/laravel-blocker)
12 | [](#contributors)
13 |
14 |
15 |
16 |
17 | Laravel Blocker (LaravelBlocker) is a middleware interface to block users, emails, ip addresses, domain names, cities, states, countries, continents, and regions from using your application, logging in, or registering. The types of items to be blocked can be extended to what you think via a seed. The items you are blocking have a CRUD interface along with a softdeletes interface.
18 |
19 | #### Table of contents
20 | - [Features](#features)
21 | - [Requirements](#requirements)
22 | - [Required Packages](#required-packages)
23 | - [Installation Instructions](#installation-instructions)
24 | - [Publish All Assets](#publish-all-assets)
25 | - [Publish Specific Assets](#publish-specific-assets)
26 | - [Usage](#usage)
27 | - [Configuration](#configuration)
28 | - [Environment File](#environment-file)
29 | - [Routes](#routes)
30 | - [Screenshots](#screenshots)
31 | - [File Tree](#file-tree)
32 | - [License](#license)
33 |
34 | Can work out the box with or without the following roles packages:
35 | * [jeremykenedy/laravel-roles](https://github.com/jeremykenedy/laravel-roles)
36 | * [spatie/laravel-permission](https://github.com/spatie/laravel-permission)
37 | * [Zizaco/entrust](https://github.com/Zizaco/entrust)
38 | * [romanbican/roles](https://github.com/romanbican/roles)
39 | * [ultraware/roles](https://github.com/ultraware/roles)
40 |
41 | ### Features
42 | | LaravelBlocker Features |
43 | | :------------ |
44 | |Easy to use middlware that can be applied directly to controller and/or routes|
45 | |Full CRUD (Create, Read, Update, Delete) interface for adding blocked items|
46 | |Lots of easily customizable options through .env file variables|
47 | |Seeded blocked types with ability to add own published seeds|
48 | |Seeded blocked items with ability to add own published seeds|
49 | |Softdeletes with easy to use restore and destroy interface|
50 | |Uses [laravelcollective/html](https://github.com/LaravelCollective/html) package for secure HTML forms|
51 | |Uses [eklundkristoffer/seedster](https://github.com/eklundkristoffer/seedster) for optional default seeds|
52 | |Makes use of proper custom request classes structure|
53 | |Can use pagination if desired for dashboards|
54 | |Front end Bootstrap version can be changed|
55 | |Uses [localization](https://laravel.com/docs/5.8/localization) language files|
56 | |Ajax search for blocked items|
57 | |Configurable blocked action|
58 |
59 | ### Requirements
60 | * [Laravel 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0+, 7.0+, and 8.0+](https://laravel.com/docs/installation)
61 |
62 | #### Required Packages
63 | (included in this package)
64 | * [laravelcollective/html](https://packagist.org/packages/laravelcollective/html)
65 | * [eklundkristoffer/seedster](https://github.com/eklundkristoffer/seedster)
66 |
67 | ### Installation Instructions
68 | 1. From your projects root folder in terminal run:
69 |
70 | Laravel 5.8+ use:
71 |
72 | ```bash
73 | composer require jeremykenedy/laravel-blocker
74 | ```
75 |
76 | Laravel 5.7 and below use:
77 |
78 | ```
79 | composer require jeremykenedy/laravel-blocker:v1.0.6
80 | ```
81 |
82 |
83 | 2. Register the package
84 |
85 | * Laravel 5.5 and up
86 | Uses package auto discovery feature, no need to edit the `config/app.php` file.
87 |
88 | * Laravel 5.4 and below
89 | Register the package with laravel in `config/app.php` under `providers` with the following:
90 |
91 | ```php
92 | 'providers' => [
93 | Collective\Html\HtmlServiceProvider::class,
94 | jeremykenedy\LaravelBlocker\LaravelBlockerServiceProvider::class,
95 | ];
96 | ```
97 |
98 | In `config/app.php` section under `aliases` with the following:
99 |
100 | ```php
101 | 'Form' => Collective\Html\FormFacade::class,
102 | 'Html' => Collective\Html\HtmlFacade::class,
103 | ```
104 |
105 | 3. Publish the packages views, config file, assets, and language files by running the following from your projects root folder:
106 |
107 | #### Publish All Assets
108 | ```bash
109 | php artisan vendor:publish --provider="jeremykenedy\LaravelBlocker\LaravelBlockerServiceProvider"
110 | ```
111 |
112 | #### Publish Specific Assets
113 | ```bash
114 | php artisan vendor:publish --tag=laravelblocker-config
115 | php artisan vendor:publish --tag=laravelblocker-views
116 | php artisan vendor:publish --tag=laravelblocker-lang
117 | php artisan vendor:publish --tag=laravelblocker-migrations
118 | php artisan vendor:publish --tag=laravelblocker-seeds
119 | ```
120 |
121 | ### Usage
122 |
123 | ##### From Route File:
124 | * You can include the `checkblocked` in a route groups or on individual routes.
125 |
126 | ###### Route Group Example:
127 |
128 | ```php
129 | Route::group(['middleware' => ['web', 'checkblocked']], function () {
130 | Route::get('/', 'WelcomeController@welcome');
131 | });
132 | ```
133 |
134 | ###### Individual Route Examples:
135 |
136 | ```php
137 | Route::get('/', 'WelcomeController@welcome')->middleware('checkblocked');
138 | Route::match(['post'], '/test', 'Testing\TestingController@runTest')->middleware('checkblocked');
139 | ```
140 |
141 | ##### From Controller File:
142 | * You can include the `checkblocked` in the contructor of your controller file.
143 |
144 | ###### Controller File Example:
145 |
146 | ```php
147 | /**
148 | * Create a new controller instance.
149 | *
150 | * @return void
151 | */
152 | public function __construct()
153 | {
154 | $this->middleware('checkblocked');
155 | }
156 | ```
157 |
158 | ### Configuration
159 | There are many configurable options which have all been extended to be able to configured via `.env` file variables. Editing the configuration file directly is not needed becuase of this.
160 |
161 | * See config file: [laravelblocker.php](https://github.com/jeremykenedy/LaravelBlocker/blob/development/src/config/laravelblocker.php).
162 | * See default Types Seed: [DefaultBlockedTypeTableSeeder.php](https://github.com/jeremykenedy/LaravelBlocker/blob/development/src/database/seeds/DefaultBlockedTypeTableSeeder.php)
163 | * See default Blocked Items seed: [DefaultBlockedItemsTableSeeder.php](https://github.com/jeremykenedy/LaravelBlocker/blob/development/src/database/seeds/DefaultBlockedItemsTableSeeder.php)
164 |
165 | ```php
166 |
167 | env('LARAVEL_BLOCKER_ENABLED', true),
177 |
178 | /*
179 | |--------------------------------------------------------------------------
180 | | Laravel Blocker Database Settings
181 | |--------------------------------------------------------------------------
182 | */
183 | 'blockerDatabaseConnection' => env('LARAVEL_BLOCKER_DATABASE_CONNECTION', 'mysql'),
184 | 'blockerDatabaseTable' => env('LARAVEL_BLOCKER_DATABASE_TABLE', 'laravel_blocker'),
185 | 'blockerTypeDatabaseTable' => env('LARAVEL_BLOCKER_TYPE_DATABASE_TABLE', 'laravel_blocker_types'),
186 | 'seedDefaultBlockedTypes' => env('LARAVEL_BLOCKER_SEED_DEFAULT_TYPES', true),
187 | 'seedDefaultBlockedItems' => env('LARAVEL_BLOCKER_SEED_DEFAULT_ITEMS', true),
188 | 'seedPublishedBlockedTypes' => env('LARAVEL_BLOCKER_TYPES_SEED_PUBLISHED', true),
189 | 'seedPublishedBlockedItems' => env('LARAVEL_BLOCKER_ITEMS_SEED_PUBLISHED', true),
190 | 'useSeededBlockedTypes' => env('LARAVEL_BLOCKER_USE_TYPES_SEED_PUBLISHED', false),
191 | 'useSeededBlockedItems' => env('LARAVEL_BLOCKER_USE_ITEMS_SEED_PUBLISHED', false),
192 |
193 | /*
194 | |--------------------------------------------------------------------------
195 | | Laravel Default User Model
196 | |--------------------------------------------------------------------------
197 | */
198 | 'defaultUserModel' => env('LARAVEL_BLOCKER_USER_MODEL', 'App\User'),
199 |
200 | /*
201 | |--------------------------------------------------------------------------
202 | | Laravel Blocker Front End Settings
203 | |--------------------------------------------------------------------------
204 | */
205 | // The parent blade file
206 | 'laravelBlockerBladeExtended' => env('LARAVEL_BLOCKER_BLADE_EXTENDED', 'layouts.app'),
207 |
208 | // Titles placement extend
209 | 'laravelBlockerTitleExtended' => env('LARAVEL_BLOCKER_TITLE_EXTENDED', 'template_title'),
210 |
211 | // Switch Between bootstrap 3 `panel` and bootstrap 4 `card` classes
212 | 'blockerBootstapVersion' => env('LARAVEL_BLOCKER_BOOTSTRAP_VERSION', '4'),
213 |
214 | // Additional Card classes for styling -
215 | // See: https://getbootstrap.com/docs/4.0/components/card/#background-and-color
216 | // Example classes: 'text-white bg-primary mb-3'
217 | 'blockerBootstrapCardClasses' => env('LARAVEL_BLOCKER_CARD_CLASSES', ''),
218 |
219 | // Blade Extension Placement
220 | 'blockerBladePlacement' => env('LARAVEL_BLOCKER_BLADE_PLACEMENT', 'yield'),
221 | 'blockerBladePlacementCss' => env('LARAVEL_BLOCKER_BLADE_PLACEMENT_CSS', 'inline_template_linked_css'),
222 | 'blockerBladePlacementJs' => env('LARAVEL_BLOCKER_BLADE_PLACEMENT_JS', 'inline_footer_scripts'),
223 |
224 | // jQuery
225 | 'enablejQueryCDN' => env('LARAVEL_BLOCKER_JQUERY_CDN_ENABLED', true),
226 | 'JQueryCDN' => env('LARAVEL_BLOCKER_JQUERY_CDN_URL', 'https://code.jquery.com/jquery-3.3.1.min.js'),
227 |
228 | // Font Awesome
229 | 'blockerEnableFontAwesomeCDN' => env('LARAVEL_BLOCKER_FONT_AWESOME_CDN_ENABLED', true),
230 | 'blockerFontAwesomeCDN' => env('LARAVEL_BLOCKER_FONT_AWESOME_CDN_URL', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'),
231 |
232 | // Bootstrap Tooltips
233 | 'tooltipsEnabled' => env('LARAVEL_BLOCKER_TOOLTIPS_ENABLED', true),
234 |
235 | // jQuery IP Mask
236 | 'jQueryIpMaskEnabled' => env('LARAVEL_BLOCKER_JQUERY_IP_MASK_ENABLED', true),
237 | 'jQueryIpMaskCDN' => env('LARAVEL_BLOCKER_JQUERY_IP_MASK_CDN', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.js'),
238 |
239 | // Flash Messaging
240 | 'blockerFlashMessagesEnabled' => env('LARAVEL_BLOCKER_FLASH_MESSAGES_ENABLED', true),
241 |
242 | // Enable Search Blocked - Uses jQuery Ajax
243 | 'enableSearchBlocked' => env('LARAVEL_BLOCKER_SEARCH_ENABLED', true),
244 |
245 | /*
246 | |--------------------------------------------------------------------------
247 | | Laravel Blocker Auth & Roles Settings
248 | |--------------------------------------------------------------------------
249 | */
250 | // Enable `auth` middleware
251 | 'authEnabled' => env('LARAVEL_BLOCKER_AUTH_ENABLED', true),
252 |
253 | // Enable Optional Roles Middleware
254 | 'rolesEnabled' => env('LARAVEL_BLOCKER_ROLES_ENABLED', false),
255 |
256 | // Optional Roles Middleware
257 | 'rolesMiddlware' => env('LARAVEL_BLOCKER_ROLES_MIDDLWARE', 'role:admin'),
258 |
259 | /*
260 | |--------------------------------------------------------------------------
261 | | Laravel Blocker Pagination Settings
262 | |--------------------------------------------------------------------------
263 | */
264 | 'blockerPaginationEnabled' => env('LARAVEL_BLOCKER_PAGINATION_ENABLED', false),
265 | 'blockerPaginationPerPage' => env('LARAVEL_BLOCKER_PAGINATION_PER_PAGE', 25),
266 |
267 | /*
268 | |--------------------------------------------------------------------------
269 | | Laravel Blocker Databales Settings - Not recommended with pagination.
270 | |--------------------------------------------------------------------------
271 | */
272 | 'blockerDatatables' => env('LARAVEL_BLOCKER_DATATABLES_ENABLED', false),
273 | 'enabledDatatablesJs' => env('LARAVEL_BLOCKER_DATATABLES_JS_ENABLED', false),
274 | 'datatablesJsStartCount' => env('LARAVEL_BLOCKER_DATATABLES_JS_START_COUNT', 25),
275 | 'datatablesCssCDN' => env('LARAVEL_BLOCKER_DATATABLES_CSS_CDN', 'https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css'),
276 | 'datatablesJsCDN' => env('LARAVEL_BLOCKER_DATATABLES_JS_CDN', 'https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js'),
277 | 'datatablesJsPresetCDN' => env('LARAVEL_BLOCKER_DATATABLES_JS_PRESET_CDN', 'https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js'),
278 |
279 | /*
280 | |--------------------------------------------------------------------------
281 | | Laravel Blocker Actions Options
282 | |--------------------------------------------------------------------------
283 | */
284 | 'blockerDefaultAction' => env('LARAVEL_BLOCKER_DEFAULT_ACTION', 'abort'), //'abort', 'view' ,'redirect'
285 | 'blockerDefaultActionAbortType' => env('LARAVEL_BLOCKER_DEFAULT_ACTION_ABORT_TYPE', '403'),
286 | 'blockerDefaultActionView' => env('LARAVEL_BLOCKER_DEFAULT_ACTION_VIEW', 'welcome'),
287 | 'blockerDefaultActionRedirect' => env('LARAVEL_BLOCKER_DEFAULT_ACTION_REDIRECT', '/'), // Internal or external
288 | ];
289 |
290 |
291 | ```
292 |
293 | ### Testing, Faker, and this package
294 |
295 | This package is great at blocking unwanted content from your application, but your configuration may conflict with auto generated content in your Laravel Factories. A common example is when your application is set to block email addresses that match @example.com, one of the most common email address TLD generated by `$faker->safeEmail`.
296 |
297 | To avoid this package throwing inaccurate failures with auto-generated models, make sure you disable this package in your `phpunit.xml` configuration file:
298 |
299 | ```xml
300 |
301 |
302 | ...
303 |
304 | ...
305 |
306 | ...
307 |
308 |
309 | ```
310 |
311 | ##### Environment File
312 | ```
313 | # Laravel Blocker Core Setting
314 | LARAVEL_BLOCKER_ENABLED=true
315 |
316 | # Laravel Blocker Database Settings
317 | LARAVEL_BLOCKER_DATABASE_CONNECTION='mysql'
318 | LARAVEL_BLOCKER_DATABASE_TABLE='laravel_blocker'
319 | LARAVEL_BLOCKER_TYPE_DATABASE_TABLE='laravel_blocker_types'
320 | LARAVEL_BLOCKER_SEED_DEFAULT_TYPES=true
321 | LARAVEL_BLOCKER_SEED_DEFAULT_ITEMS=true
322 | LARAVEL_BLOCKER_TYPES_SEED_PUBLISHED=true
323 | LARAVEL_BLOCKER_ITEMS_SEED_PUBLISHED=true
324 | LARAVEL_BLOCKER_USE_TYPES_SEED_PUBLISHED=false
325 | LARAVEL_BLOCKER_USE_ITEMS_SEED_PUBLISHED=false
326 |
327 | # Laravel Default User Model
328 | LARAVEL_BLOCKER_USER_MODEL='App\User'
329 |
330 | # Laravel Blocker Front End Settings
331 | LARAVEL_BLOCKER_BLADE_EXTENDED='layouts.app'
332 | LARAVEL_BLOCKER_TITLE_EXTENDED='template_title'
333 | LARAVEL_BLOCKER_BOOTSTRAP_VERSION='4'
334 | LARAVEL_BLOCKER_CARD_CLASSES=''
335 | LARAVEL_BLOCKER_BLADE_PLACEMENT='yield'
336 | LARAVEL_BLOCKER_BLADE_PLACEMENT_CSS='template_linked_css'
337 | LARAVEL_BLOCKER_BLADE_PLACEMENT_JS='footer_scripts'
338 | LARAVEL_BLOCKER_JQUERY_CDN_ENABLED=true
339 | LARAVEL_BLOCKER_JQUERY_CDN_URL='https://code.jquery.com/jquery-3.2.1.slim.min.js'
340 | LARAVEL_BLOCKER_FONT_AWESOME_CDN_ENABLED=true
341 | LARAVEL_BLOCKER_FONT_AWESOME_CDN_URL='https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'
342 | LARAVEL_BLOCKER_TOOLTIPS_ENABLED=true
343 | LARAVEL_BLOCKER_JQUERY_IP_MASK_ENABLED=true
344 | LARAVEL_BLOCKER_JQUERY_IP_MASK_CDN='https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.js'
345 | LARAVEL_BLOCKER_FLASH_MESSAGES_ENABLED=true
346 | LARAVEL_BLOCKER_SEARCH_ENABLED=true
347 |
348 | # Laravel Blocker Auth & Roles Settings
349 | LARAVEL_BLOCKER_AUTH_ENABLED=true
350 | LARAVEL_BLOCKER_ROLES_ENABLED=false
351 | LARAVEL_BLOCKER_ROLES_MIDDLWARE='role:admin'
352 |
353 | # Laravel Blocker Pagination Settings
354 | LARAVEL_BLOCKER_PAGINATION_ENABLED=false
355 | LARAVEL_BLOCKER_PAGINATION_PER_PAGE=25
356 |
357 | # Laravel Blocker Databales Settings - Not recommended with pagination.
358 | LARAVEL_BLOCKER_DATATABLES_ENABLED=false
359 | LARAVEL_BLOCKER_DATATABLES_JS_ENABLED=false
360 | LARAVEL_BLOCKER_DATATABLES_JS_START_COUNT=25
361 | LARAVEL_BLOCKER_DATATABLES_CSS_CDN='https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css'
362 | LARAVEL_BLOCKER_DATATABLES_JS_CDN='https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js'
363 | LARAVEL_BLOCKER_DATATABLES_JS_PRESET_CDN='https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js'
364 |
365 | # Laravel Blocker Actions Options
366 | LARAVEL_BLOCKER_DEFAULT_ACTION='abort'
367 | LARAVEL_BLOCKER_DEFAULT_ACTION_ABORT_TYPE='403'
368 | LARAVEL_BLOCKER_DEFAULT_ACTION_VIEW='welcome'
369 | LARAVEL_BLOCKER_DEFAULT_ACTION_REDIRECT='/'
370 | ```
371 |
372 | ### Routes
373 | * ```/blocker```
374 | * ```/blocker/{id}```
375 | * ```/blocker/create```
376 | * ```/blocker/{id}/edit```
377 | * ```/blocker-deleted```
378 | * ```/blocker-deleted/{id}```
379 | * ```/blocker-deleted/{id}```
380 |
381 | ###### Routes In-depth
382 | ```
383 | +--------+----------------------------------------+---------------------------------------+---------------------------------------------+---------------------------------------------------------------------------------------------------------+--------------------------------------------------------------+
384 | | Domain | Method | URI | Name | Action | Middleware |
385 | +--------+----------------------------------------+---------------------------------------+---------------------------------------------+---------------------------------------------------------------------------------------------------------+--------------------------------------------------------------+
386 | | | GET|HEAD | blocker | laravelblocker::blocker.index | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController@index | web,checkblocked,auth |
387 | | | POST | blocker | laravelblocker::blocker.store | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController@store | web,checkblocked,auth |
388 | | | GET|HEAD | blocker-deleted | laravelblocker::blocker-deleted | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerDeletedController@index | web,checkblocked,auth |
389 | | | DELETE | blocker-deleted-destroy-all | laravelblocker::destroy-all-blocked | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerDeletedController@destroyAllItems | web,checkblocked,auth |
390 | | | POST | blocker-deleted-restore-all | laravelblocker::blocker-deleted-restore-all | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerDeletedController@restoreAllBlockedItems | web,checkblocked,auth |
391 | | | DELETE | blocker-deleted/{id} | laravelblocker::blocker-item-destroy | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerDeletedController@destroy | web,checkblocked,auth |
392 | | | PUT | blocker-deleted/{id} | laravelblocker::blocker-item-restore | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerDeletedController@restoreBlockedItem | web,checkblocked,auth |
393 | | | GET|HEAD | blocker-deleted/{id} | laravelblocker::blocker-item-show-deleted | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerDeletedController@show | web,checkblocked,auth |
394 | | | GET|HEAD | blocker/create | laravelblocker::blocker.create | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController@create | web,checkblocked,auth |
395 | | | DELETE | blocker/{blocker} | laravelblocker::blocker.destroy | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController@destroy | web,checkblocked,auth |
396 | | | PUT|PATCH | blocker/{blocker} | laravelblocker::blocker.update | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController@update | web,checkblocked,auth |
397 | | | GET|HEAD | blocker/{blocker} | laravelblocker::blocker.show | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController@show | web,checkblocked,auth |
398 | | | GET|HEAD | blocker/{blocker}/edit | laravelblocker::blocker.edit | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController@edit | web,checkblocked,auth |
399 | | | POST | search-blocked | laravelblocker::search-blocked | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController@search | web,checkblocked,auth |
400 | | | POST | search-blocked-deleted | laravelblocker::search-blocked-deleted | jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerDeletedController@search | web,checkblocked,auth |
401 | +--------+----------------------------------------+---------------------------------------+---------------------------------------------+---------------------------------------------------------------------------------------------------------+--------------------------------------------------------------+
402 | ```
403 |
404 | ### Screenshots
405 | 
406 | 
407 | 
408 | 
409 | 
410 | 
411 | 
412 | 
413 | 
414 | 
415 | 
416 |
417 | ### File Tree
418 | ```bash
419 | ├── .all-contributorsrc
420 | ├── .env.travis
421 | ├── .gitignore
422 | ├── .travis.yml
423 | ├── LICENSE
424 | ├── README.md
425 | ├── composer.json
426 | ├── phpunit.xml
427 | └── src
428 | ├── App
429 | │ ├── Http
430 | │ │ ├── Controllers
431 | │ │ │ ├── LaravelBlockerController.php
432 | │ │ │ └── LaravelBlockerDeletedController.php
433 | │ │ ├── Middleware
434 | │ │ │ └── LaravelBlocker.php
435 | │ │ └── Requests
436 | │ │ ├── SearchBlockerRequest.php
437 | │ │ ├── StoreBlockerRequest.php
438 | │ │ └── UpdateBlockerRequest.php
439 | │ ├── Models
440 | │ │ ├── BlockedItem.php
441 | │ │ └── BlockedType.php
442 | │ ├── Rules
443 | │ │ └── UniqueBlockerItemValueEmail.php
444 | │ └── Traits
445 | │ ├── IpAddressDetails.php
446 | │ └── LaravelCheckBlockedTrait.php
447 | ├── LaravelBlockerFacade.php
448 | ├── LaravelBlockerServiceProvider.php
449 | ├── config
450 | │ └── laravelblocker.php
451 | ├── database
452 | │ ├── migrations
453 | │ │ ├── 2019_02_19_032636_create_laravel_blocker_types_table.php
454 | │ │ └── 2019_02_19_045158_create_laravel_blocker_table.php
455 | │ └── seeds
456 | │ ├── DefaultBlockedItemsTableSeeder.php
457 | │ ├── DefaultBlockedTypeTableSeeder.php
458 | │ └── publish
459 | │ ├── BlockedItemsTableSeeder.php
460 | │ └── BlockedTypeTableSeeder.php
461 | ├── resources
462 | │ ├── lang
463 | │ │ └── en
464 | │ │ └── laravelblocker.php
465 | │ └── views
466 | │ ├── forms
467 | │ │ ├── create-new.blade.php
468 | │ │ ├── delete-full.blade.php
469 | │ │ ├── delete-item.blade.php
470 | │ │ ├── delete-sm.blade.php
471 | │ │ ├── destroy-all.blade.php
472 | │ │ ├── destroy-full.blade.php
473 | │ │ ├── destroy-sm.blade.php
474 | │ │ ├── edit-form.blade.php
475 | │ │ ├── partials
476 | │ │ │ ├── item-blocked-user-select.blade.php
477 | │ │ │ ├── item-note-input.blade.php
478 | │ │ │ ├── item-type-select.blade.php
479 | │ │ │ └── item-value-input.blade.php
480 | │ │ ├── restore-all.blade.php
481 | │ │ ├── restore-item.blade.php
482 | │ │ └── search-blocked.blade.php
483 | │ ├── laravelblocker
484 | │ │ ├── create.blade.php
485 | │ │ ├── deleted
486 | │ │ │ └── index.blade.php
487 | │ │ ├── edit.blade.php
488 | │ │ ├── index.blade.php
489 | │ │ └── show.blade.php
490 | │ ├── modals
491 | │ │ └── confirm-modal.blade.php
492 | │ ├── partials
493 | │ │ ├── blocked-items-table.blade.php
494 | │ │ ├── bs-visibility-css.blade.php
495 | │ │ ├── flash-messages.blade.php
496 | │ │ ├── form-status.blade.php
497 | │ │ └── styles.blade.php
498 | │ └── scripts
499 | │ ├── blocked-form.blade.php
500 | │ ├── confirm-modal.blade.php
501 | │ ├── datatables.blade.php
502 | │ ├── search-blocked.blade.php
503 | │ └── tooltips.blade.php
504 | └── routes
505 | └── web.php
506 | ```
507 |
508 | * Tree command can be installed using brew: `brew install tree`
509 | * File tree generated using command `tree -a -I '.git|node_modules|vendor|storage|tests'`
510 |
511 | ### License
512 | LaravelBlocker is licensed under the [MIT license](https://opensource.org/licenses/MIT). Enjoy!
513 |
514 | ### Contributors
515 | Thanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key)):
516 |
517 |
518 |
519 | | [
Jeremy Kenedy](http://jeremykenedy.github.io/)
[💻](https://github.com/jeremykenedy/laravel-blocker/commits?author=jeremykenedy "Code") |
520 | | :---: |
521 |
522 |
523 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
524 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jeremykenedy/laravel-blocker",
3 | "description": "",
4 | "keywords": [
5 | "laravel blocker",
6 | "laravel IP blocker",
7 | "laravel Email blocker",
8 | "Email blocker",
9 | "User blocker",
10 | "IP blocker",
11 | "Blocker"
12 | ],
13 | "license": "MIT",
14 | "type": "package",
15 | "authors": [
16 | {
17 | "name": "Jeremy Kenedy",
18 | "email": "jeremykenedy@gmail.com"
19 | }
20 | ],
21 | "require": {
22 | "php": "^7.3|^8.0|^8.1|^8.2",
23 | "eklundkristoffer/seedster": "^7.0",
24 | "laravelcollective/html": "^6.4"
25 | },
26 | "autoload": {
27 | "psr-4": {
28 | "jeremykenedy\\LaravelBlocker\\": "src/"
29 | }
30 | },
31 | "extra": {
32 | "laravel": {
33 | "providers": [
34 | "jeremykenedy\\LaravelBlocker\\LaravelBlockerServiceProvider"
35 | ]
36 | }
37 | },
38 | "config": {
39 | "sort-packages": true
40 | },
41 | "minimum-stability": "stable"
42 | }
43 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 | ./tests/Feature
15 |
16 |
17 |
18 |
19 | src/
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/App/Http/Controllers/LaravelBlockerController.php:
--------------------------------------------------------------------------------
1 | _authEnabled = config('laravelblocker.authEnabled');
27 | $this->_rolesEnabled = config('laravelblocker.rolesEnabled');
28 | $this->_rolesMiddlware = config('laravelblocker.rolesMiddlware');
29 |
30 | if ($this->_authEnabled) {
31 | $this->middleware('auth');
32 | }
33 |
34 | if ($this->_rolesEnabled) {
35 | $this->middleware($this->_rolesMiddlware);
36 | }
37 | }
38 |
39 | /**
40 | * Show the laravel ip email blocker dashboard.
41 | *
42 | * @return \Illuminate\Http\Response
43 | */
44 | public function index()
45 | {
46 | if (config('laravelblocker.blockerPaginationEnabled')) {
47 | $blocked = BlockedItem::paginate(config('laravelblocker.blockerPaginationPerPage'));
48 | } else {
49 | $blocked = BlockedItem::all();
50 | }
51 |
52 | $deletedBlockedItems = BlockedItem::onlyTrashed();
53 |
54 | return view('laravelblocker::laravelblocker.index', compact('blocked', 'deletedBlockedItems'));
55 | }
56 |
57 | /**
58 | * Show the form for creating a new resource.
59 | *
60 | * @return \Illuminate\Http\Response
61 | */
62 | public function create()
63 | {
64 | $blockedTypes = BlockedType::all();
65 | $users = config('laravelblocker.defaultUserModel')::all();
66 |
67 | return view('laravelblocker::laravelblocker.create', compact('blockedTypes', 'users'));
68 | }
69 |
70 | /**
71 | * Store a newly created resource in storage.
72 | *
73 | * @param StoreBlockerRequest $request
74 | *
75 | * @return \Illuminate\Http\Response
76 | */
77 | public function store(StoreBlockerRequest $request)
78 | {
79 | BlockedItem::create($request->blockedFillData());
80 |
81 | return redirect('blocker')
82 | ->with('success', trans('laravelblocker::laravelblocker.messages.blocked-creation-success'));
83 | }
84 |
85 | /**
86 | * Display the specified resource.
87 | *
88 | * @param int $id
89 | *
90 | * @return \Illuminate\Http\Response
91 | */
92 | public function show($id)
93 | {
94 | $item = BlockedItem::findOrFail($id);
95 |
96 | return view('laravelblocker::laravelblocker.show', compact('item'));
97 | }
98 |
99 | /**
100 | * Display the specified resource.
101 | *
102 | * @param int $id
103 | *
104 | * @return \Illuminate\Http\Response
105 | */
106 | public function edit($id)
107 | {
108 | $blockedTypes = BlockedType::all();
109 | $users = config('laravelblocker.defaultUserModel')::all();
110 | $item = BlockedItem::findOrFail($id);
111 |
112 | return view('laravelblocker::laravelblocker.edit', compact('blockedTypes', 'users', 'item'));
113 | }
114 |
115 | /**
116 | * Update the specified resource in storage.
117 | *
118 | * @param UpdateBlockerRequest $request
119 | * @param int $id
120 | *
121 | * @return \Illuminate\Http\Response
122 | */
123 | public function update(UpdateBlockerRequest $request, $id)
124 | {
125 | $item = BlockedItem::findOrFail($id);
126 | $item->fill($request->blockedFillData());
127 | $item->save();
128 |
129 | return redirect()
130 | ->back()
131 | ->with('success', trans('laravelblocker::laravelblocker.messages.update-success'));
132 | }
133 |
134 | /**
135 | * Remove the specified resource from storage.
136 | *
137 | * @param int $id
138 | *
139 | * @return \Illuminate\Http\Response
140 | */
141 | public function destroy($id)
142 | {
143 | $blockedItem = BlockedItem::findOrFail($id);
144 | $blockedItem->delete();
145 |
146 | return redirect('blocker')
147 | ->with('success', trans('laravelblocker::laravelblocker.messages.delete-success'));
148 | }
149 |
150 | /**
151 | * Method to search the blocked items.
152 | *
153 | * @param SearchBlockerRequest $request
154 | *
155 | * @return \Illuminate\Http\Response
156 | */
157 | public function search(SearchBlockerRequest $request)
158 | {
159 | $searchTerm = $request->validated()['blocked_search_box'];
160 | $results = BlockedItem::where('id', 'like', $searchTerm.'%')
161 | ->orWhere('typeId', 'like', $searchTerm.'%')
162 | ->orWhere('value', 'like', $searchTerm.'%')
163 | ->orWhere('note', 'like', $searchTerm.'%')
164 | ->orWhere('userId', 'like', $searchTerm.'%')
165 | ->get();
166 |
167 | $results->map(function ($item) {
168 | $item['type'] = $item->blockedType->slug;
169 |
170 | return $item;
171 | });
172 |
173 | return response()->json([
174 | json_encode($results),
175 | ], Response::HTTP_OK);
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/src/App/Http/Controllers/LaravelBlockerDeletedController.php:
--------------------------------------------------------------------------------
1 | where('id', $id)->get();
22 | if (count($item) != 1) {
23 | return abort(redirect('blocker-deleted')
24 | ->with('error', trans('laravelblocker::laravelblocker.errors.errorBlockerNotFound')));
25 | }
26 |
27 | return $item[0];
28 | }
29 |
30 | /**
31 | * Show the laravel ip blocker deleted dashboard.
32 | *
33 | * @return \Illuminate\Http\Response
34 | */
35 | public function index()
36 | {
37 | if (config('laravelblocker.blockerPaginationEnabled')) {
38 | $blocked = BlockedItem::onlyTrashed()->paginate(config('laravelblocker.blockerPaginationPerPage'));
39 | } else {
40 | $blocked = BlockedItem::onlyTrashed()->get();
41 | }
42 |
43 | return view('laravelblocker::laravelblocker.deleted.index', compact('blocked'));
44 | }
45 |
46 | /**
47 | * Display the specified resource.
48 | *
49 | * @param int $id
50 | *
51 | * @return \Illuminate\Http\Response
52 | */
53 | public function show($id)
54 | {
55 | $item = self::getDeletedBlockedItem($id);
56 | $typeDeleted = 'deleted';
57 |
58 | return view('laravelblocker::laravelblocker.show', compact('item', 'typeDeleted'));
59 | }
60 |
61 | /**
62 | * Update the specified resource in storage.
63 | *
64 | * @param \Illuminate\Http\Request $request
65 | * @param int $id
66 | *
67 | * @return \Illuminate\Http\Response
68 | */
69 | public function restoreBlockedItem(Request $request, $id)
70 | {
71 | $item = self::getDeletedBlockedItem($id);
72 | $item->restore();
73 |
74 | return redirect('blocker')
75 | ->with('success', trans('laravelblocker::laravelblocker.messages.successRestoredItem'));
76 | }
77 |
78 | /**
79 | * Restore all the specified resource from soft deleted storage.
80 | *
81 | * @param Request $request
82 | *
83 | * @return \Illuminate\Http\Response
84 | */
85 | public function restoreAllBlockedItems(Request $request)
86 | {
87 | $items = BlockedItem::onlyTrashed()->get();
88 | foreach ($items as $item) {
89 | $item->restore();
90 | }
91 |
92 | return redirect('blocker')
93 | ->with('success', trans('laravelblocker::laravelblocker.messages.successRestoredAllItems'));
94 | }
95 |
96 | /**
97 | * Remove the specified resource from storage.
98 | *
99 | * @param int $id
100 | *
101 | * @return \Illuminate\Http\Response
102 | */
103 | public function destroy($id)
104 | {
105 | $item = self::getDeletedBlockedItem($id);
106 | $item->forceDelete();
107 |
108 | return redirect('blocker-deleted')
109 | ->with('success', trans('laravelblocker::laravelblocker.messages.successDestroyedItem'));
110 | }
111 |
112 | /**
113 | * Destroy all the specified resource from storage.
114 | *
115 | * @param Request $request
116 | *
117 | * @return \Illuminate\Http\Response
118 | */
119 | public function destroyAllItems(Request $request)
120 | {
121 | $items = BlockedItem::onlyTrashed()->get();
122 |
123 | foreach ($items as $item) {
124 | $item->forceDelete();
125 | }
126 |
127 | return redirect('blocker')
128 | ->with('success', trans('laravelblocker::laravelblocker.messages.successDestroyedAllItems'));
129 | }
130 |
131 | /**
132 | * Method to search the deleted blocked items.
133 | *
134 | * @param SearchBlockerRequest $request
135 | *
136 | * @return \Illuminate\Http\Response
137 | */
138 | public function search(SearchBlockerRequest $request)
139 | {
140 | $searchTerm = $request->validated()['blocked_search_box'];
141 | $results = BlockedItem::onlyTrashed()->where('id', 'like', $searchTerm.'%')->onlyTrashed()
142 | ->orWhere('typeId', 'like', $searchTerm.'%')->onlyTrashed()
143 | ->orWhere('value', 'like', $searchTerm.'%')->onlyTrashed()
144 | ->orWhere('note', 'like', $searchTerm.'%')->onlyTrashed()
145 | ->orWhere('userId', 'like', $searchTerm.'%')->onlyTrashed()
146 | ->get();
147 |
148 | $results->map(function ($item) {
149 | $item['type'] = $item->blockedType->slug;
150 |
151 | return $item;
152 | });
153 |
154 | return response()->json([
155 | json_encode($results),
156 | ], Response::HTTP_OK);
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/src/App/Http/Middleware/LaravelBlocker.php:
--------------------------------------------------------------------------------
1 | 'required|string|max:255',
32 | ];
33 | }
34 |
35 | /**
36 | * Get the error messages for the defined validation rules.
37 | *
38 | * @return array
39 | */
40 | public function messages()
41 | {
42 | return [
43 | 'blocked_search_box.required' => trans('laravelblocker::laravelblocker.search.required'),
44 | 'blocked_search_box.string' => trans('laravelblocker::laravelblocker.search.string'),
45 | 'blocked_search_box.max' => trans('laravelblocker::laravelblocker.search.max'),
46 | ];
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/App/Http/Requests/StoreBlockerRequest.php:
--------------------------------------------------------------------------------
1 | route('blocker');
33 |
34 | return [
35 | 'typeId' => 'required|max:255|integer',
36 | 'value' => ['required', 'max:255', 'string', 'unique:laravel_blocker,value,'.$id.',id', new UniqueBlockerItemValueEmail(Request::input('typeId'))],
37 | 'note' => 'nullable|max:500|string',
38 | 'userId' => 'nullable|integer',
39 | ];
40 | }
41 |
42 | /**
43 | * Get the error messages for the defined validation rules.
44 | *
45 | * @return array
46 | */
47 | public function messages()
48 | {
49 | return [
50 | 'typeId.required' => trans('laravelblocker::laravelblocker.validation.blockedTypeRequired'),
51 | 'value.required' => trans('laravelblocker::laravelblocker.validation.blockedValueRequired'),
52 | ];
53 | }
54 |
55 | /**
56 | * Return the fields and values for a Blocked Item.
57 | *
58 | * @return array
59 | */
60 | public function blockedFillData()
61 | {
62 | $userId = null;
63 | if ($this->userId) {
64 | $userId = $this->userId;
65 | }
66 |
67 | return [
68 | 'typeId' => $this->typeId,
69 | 'value' => $this->value,
70 | 'note' => $this->note,
71 | 'userId' => $userId,
72 | ];
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/App/Http/Requests/UpdateBlockerRequest.php:
--------------------------------------------------------------------------------
1 | 'integer',
67 | 'value' => 'string',
68 | 'note' => 'string',
69 | 'userId' => 'integer',
70 | ];
71 |
72 | /**
73 | * Create a new instance to set the table and connection.
74 | *
75 | * @return void
76 | */
77 | public function __construct($attributes = [])
78 | {
79 | parent::__construct($attributes);
80 | $this->connection = config('laravelblocker.blockerDatabaseConnection');
81 | $this->table = config('laravelblocker.blockerDatabaseTable');
82 | }
83 |
84 | /**
85 | * Get the database connection.
86 | */
87 | public function getConnectionName()
88 | {
89 | return $this->connection;
90 | }
91 |
92 | /**
93 | * Get the database table.
94 | */
95 | public function getTableName()
96 | {
97 | return $this->table;
98 | }
99 |
100 | /**
101 | * The one-to-one relationship between pages and tags.
102 | *
103 | * @return hasOne
104 | */
105 | public function blockedType()
106 | {
107 | return $this->belongsTo(BlockedType::class, 'typeId');
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/src/App/Models/BlockedType.php:
--------------------------------------------------------------------------------
1 | 'string',
65 | 'name' => 'string',
66 | ];
67 |
68 | /**
69 | * Create a new instance to set the table and connection.
70 | *
71 | * @return void
72 | */
73 | public function __construct($attributes = [])
74 | {
75 | parent::__construct($attributes);
76 | $this->connection = config('laravelblocker.blockerDatabaseConnection');
77 | $this->table = config('laravelblocker.blockerTypeDatabaseTable');
78 | }
79 |
80 | /**
81 | * Get the database connection.
82 | */
83 | public function getConnectionName()
84 | {
85 | return $this->connection;
86 | }
87 |
88 | /**
89 | * Get the database table.
90 | */
91 | public function getTableName()
92 | {
93 | return $this->table;
94 | }
95 |
96 | /**
97 | * Get the blockedItems for the BlockedType.
98 | */
99 | public function blockedItems()
100 | {
101 | return $this->hasMany(BlockedItem::class);
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/src/App/Rules/UniqueBlockerItemValueEmail.php:
--------------------------------------------------------------------------------
1 | typeId = $typeId;
20 | }
21 |
22 | /**
23 | * Determine if the validation rule passes.
24 | *
25 | * @param string $attribute
26 | * @param mixed $value
27 | *
28 | * @return bool
29 | */
30 | public function passes($attribute, $value)
31 | {
32 | if ($this->typeId) {
33 | $type = BlockedType::find($this->typeId);
34 |
35 | if ($type->slug == 'email' || $type->slug == 'user') {
36 | $check = $this->checkEmail($value);
37 |
38 | if ($check) {
39 | return $value;
40 | }
41 |
42 | return false;
43 | }
44 | }
45 |
46 | return true;
47 | }
48 |
49 | /**
50 | * Check if value is proper formed email.
51 | *
52 | * @param string $email The email
53 | *
54 | * @return bool
55 | */
56 | public function checkEmail($email)
57 | {
58 | $find1 = strpos($email, '@');
59 | $find2 = strpos($email, '.');
60 |
61 | return $find1 !== false && $find2 !== false && $find2 > $find1 ? true : false;
62 | }
63 |
64 | /**
65 | * Get the validation error message.
66 | *
67 | * @return string
68 | */
69 | public function message()
70 | {
71 | return trans('laravelblocker::laravelblocker.validation.email');
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/App/Traits/IpAddressDetails.php:
--------------------------------------------------------------------------------
1 | 'Africa',
34 | 'AN' => 'Antarctica',
35 | 'AS' => 'Asia',
36 | 'EU' => 'Europe',
37 | 'OC' => 'Australia (Oceania)',
38 | 'NA' => 'North America',
39 | 'SA' => 'South America',
40 | ];
41 | if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) {
42 | $ipdat = @json_decode(file_get_contents('http://www.geoplugin.net/json.gp?ip='.$ip));
43 | if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) {
44 | switch ($purpose) {
45 | case 'location':
46 | $output = [
47 | 'city' => @$ipdat->geoplugin_city,
48 | 'state' => @$ipdat->geoplugin_regionName,
49 | 'country' => @$ipdat->geoplugin_countryName,
50 | 'countryCode' => @$ipdat->geoplugin_countryCode,
51 | 'continent' => @$continents[strtoupper($ipdat->geoplugin_continentCode)],
52 | 'continent_code' => @$ipdat->geoplugin_continentCode,
53 | 'latitude' => @$ipdat->geoplugin_latitude,
54 | 'longitude' => @$ipdat->geoplugin_longitude,
55 | 'currencyCode' => @$ipdat->geoplugin_currencyCode,
56 | 'areaCode' => @$ipdat->geoplugin_areaCode,
57 | 'dmaCode' => @$ipdat->geoplugin_dmaCode,
58 | 'region' => @$ipdat->geoplugin_region,
59 | ];
60 | break;
61 | case 'address':
62 | $address = [$ipdat->geoplugin_countryName];
63 | if (@strlen($ipdat->geoplugin_regionName) >= 1) {
64 | $address[] = $ipdat->geoplugin_regionName;
65 | }
66 | if (@strlen($ipdat->geoplugin_city) >= 1) {
67 | $address[] = $ipdat->geoplugin_city;
68 | }
69 | $output = implode(', ', array_reverse($address));
70 | break;
71 | case 'city':
72 | $output = @$ipdat->geoplugin_city;
73 | break;
74 | case 'state':
75 | $output = @$ipdat->geoplugin_regionName;
76 | break;
77 | case 'region':
78 | $output = @$ipdat->geoplugin_regionName;
79 | break;
80 | case 'country':
81 | $output = @$ipdat->geoplugin_countryName;
82 | break;
83 | case 'countrycode':
84 | $output = @$ipdat->geoplugin_countryCode;
85 | break;
86 | }
87 | }
88 | }
89 |
90 | return $output;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/App/Traits/LaravelCheckBlockedTrait.php:
--------------------------------------------------------------------------------
1 | uri === 'register') {
57 | $domain_name = self::getEmailDomain($all['email']);
58 | $blocked = self::checkedBlockedList($domain_name, $blocked);
59 | $blocked = self::checkedBlockedList($all['email'], $blocked);
60 | $type = 'register';
61 | }
62 |
63 | // Logged IN
64 | if (\Auth::check()) {
65 | $userId = Request::user()->id;
66 | $userEmail = Request::user()->email;
67 | $domain_name = self::getEmailDomain($userEmail);
68 | $blocked = self::checkedBlockedList($domain_name, $blocked);
69 | $blocked = self::checkedBlockedList($userEmail, $blocked);
70 | $type = 'auth';
71 | }
72 |
73 | self::checkBlockedActions($blocked, $type);
74 | }
75 |
76 | /**
77 | * How to responde to a blocked item.
78 | *
79 | * @param string $blocked The blocked item
80 | * @param string $type The type of blocked item
81 | */
82 | private static function checkBlockedActions($blocked, $type = null)
83 | {
84 | if ($blocked) {
85 | switch ($type) {
86 | case 'register':
87 | return Redirect::back()->withError('Not allowed');
88 | break;
89 |
90 | case 'auth':
91 | case 'ip':
92 | default:
93 | switch (config('laravelblocker.blockerDefaultAction')) {
94 | case 'view':
95 | abort(response()->view(config('laravelblocker.blockerDefaultActionView')));
96 | break;
97 |
98 | case 'redirect':
99 | $currentRoute = Request::route()->getName();
100 | $redirectRoute = config('laravelblocker.blockerDefaultActionRedirect');
101 |
102 | if ($currentRoute != $redirectRoute) {
103 | abort(redirect($redirectRoute));
104 | }
105 | break;
106 |
107 | case 'abort':
108 | default:
109 | abort(config('laravelblocker.blockerDefaultActionAbortType'));
110 | break;
111 | }
112 | break;
113 | }
114 | }
115 | }
116 |
117 | /**
118 | * Gets the email domain.
119 | *
120 | * @param string $email The email
121 | *
122 | * @return string The email domain.
123 | */
124 | private static function getEmailDomain($email)
125 | {
126 | return substr(strrchr($email, '@'), 1);
127 | }
128 |
129 | /**
130 | * { function_description }.
131 | *
132 | * @param string $checkAgainst The check against
133 | * @param bool $blocked The blocked
134 | *
135 | * @return bool ( description_of_the_return_value )
136 | */
137 | private static function checkedBlockedList($checkAgainst, $blocked)
138 | {
139 | static $blockedItems = null;
140 | if ($blockedItems === null) {
141 | $blockedItems = BlockedItem::all();
142 | }
143 |
144 | foreach ($blockedItems as $blockedItem) {
145 | if ($blockedItem->value == $checkAgainst) {
146 | $blocked = true;
147 | break;
148 | }
149 | }
150 |
151 | return $blocked;
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/src/Database/Migrations/2019_02_19_032636_create_laravel_blocker_types_table.php:
--------------------------------------------------------------------------------
1 | getConnectionName();
19 | $table = $blocked->getTableName();
20 | $tableCheck = Schema::connection($connection)->hasTable($table);
21 |
22 | if (!$tableCheck) {
23 | Schema::connection($connection)->create($table, function (Blueprint $table) {
24 | $table->increments('id');
25 | $table->string('slug')->unique();
26 | $table->string('name');
27 | $table->timestamps();
28 | $table->softDeletes();
29 | });
30 | }
31 | }
32 |
33 | /**
34 | * Reverse the migrations.
35 | *
36 | * @return void
37 | */
38 | public function down()
39 | {
40 | $blockedType = new BlockedType();
41 | $connection = $blockedType->getConnectionName();
42 | $table = $blockedType->getTableName();
43 |
44 | Schema::connection($connection)->dropIfExists($table);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Database/Migrations/2019_02_19_045158_create_laravel_blocker_table.php:
--------------------------------------------------------------------------------
1 | getConnectionName();
20 | $table = $blocked->getTableName();
21 | $tableCheck = Schema::connection($connection)->hasTable($table);
22 |
23 | if (!$tableCheck) {
24 | Schema::connection($connection)->create($table, function (Blueprint $table) {
25 | $blockedType = new BlockedType();
26 | $connectionType = $blockedType->getConnectionName();
27 | $tableTypeName = $blockedType->getTableName();
28 | $table->increments('id');
29 | $table->integer('typeId')->unsigned()->index();
30 | $table->foreign('typeId')->references('id')->on($tableTypeName)->onDelete('cascade');
31 | $table->string('value')->unique();
32 | $table->longText('note')->nullable();
33 | $table->unsignedBigInteger('userId')->unsigned()->index()->nullable();
34 | $table->foreign('userId')->references('id')->on('users')->onDelete('cascade');
35 | $table->timestamps();
36 | $table->softDeletes();
37 | });
38 | }
39 | }
40 |
41 | /**
42 | * Reverse the migrations.
43 | *
44 | * @return void
45 | */
46 | public function down()
47 | {
48 | $blocked = new BlockedItem();
49 | $connection = $blocked->getConnectionName();
50 | $table = $blocked->getTableName();
51 |
52 | Schema::connection($connection)->dropIfExists($table);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/Database/Seeders/DefaultBlockedItemsTableSeeder.php:
--------------------------------------------------------------------------------
1 | 'domain',
25 | 'value' => 'test.com',
26 | 'note' => 'Block all domains/emails @test.com',
27 | ],
28 | [
29 | 'type' => 'domain',
30 | 'value' => 'test.ca',
31 | 'note' => 'Block all domains/emails @test.ca',
32 | ],
33 | [
34 | 'type' => 'domain',
35 | 'value' => 'fake.com',
36 | 'note' => 'Block all domains/emails @fake.com',
37 | ],
38 | [
39 | 'type' => 'domain',
40 | 'value' => 'example.com',
41 | 'note' => 'Block all domains/emails @example.com',
42 | ],
43 | [
44 | 'type' => 'domain',
45 | 'value' => 'mailinator.com',
46 | 'note' => 'Block all domains/emails @mailinator.com',
47 | ],
48 | ];
49 |
50 | /*
51 | * Add Blocked Items
52 | *
53 | */
54 | foreach ($BlockedItems as $BlockedItem) {
55 | $blockType = BlockedType::where('slug', $BlockedItem['type'])->first();
56 | $newBlockedItem = BlockedItem::where('typeId', '=', $blockType->id)
57 | ->where('value', '=', $BlockedItem['value'])
58 | ->withTrashed()
59 | ->first();
60 | if ($newBlockedItem === null) {
61 | $newBlockedItem = BlockedItem::create([
62 | 'typeId' => $blockType->id,
63 | 'value' => $BlockedItem['value'],
64 | 'note' => $BlockedItem['note'],
65 | ]);
66 | }
67 | }
68 | echo "\e[32mSeeding:\e[0m DefaultBlockedItemsTableSeeder\r\n";
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/Database/Seeders/DefaultBlockedTypeTableSeeder.php:
--------------------------------------------------------------------------------
1 | 'email',
24 | 'name' => 'E-mail',
25 | ],
26 | [
27 | 'slug' => 'ipAddress',
28 | 'name' => 'IP Address',
29 | ],
30 | [
31 | 'slug' => 'domain',
32 | 'name' => 'Domain Name',
33 | ],
34 | [
35 | 'slug' => 'user',
36 | 'name' => 'User',
37 | ],
38 | [
39 | 'slug' => 'city',
40 | 'name' => 'City',
41 | ],
42 | [
43 | 'slug' => 'state',
44 | 'name' => 'State',
45 | ],
46 | [
47 | 'slug' => 'country',
48 | 'name' => 'Country',
49 | ],
50 | [
51 | 'slug' => 'countryCode',
52 | 'name' => 'Country Code',
53 | ],
54 | [
55 | 'slug' => 'continent',
56 | 'name' => 'Continent',
57 | ],
58 | [
59 | 'slug' => 'region',
60 | 'name' => 'Region',
61 | ],
62 | ];
63 |
64 | /*
65 | * Add Blocked Types
66 | *
67 | */
68 | foreach ($BlockedTypes as $BlockedType) {
69 | $newBlockedType = BlockedType::where('slug', '=', $BlockedType['slug'])
70 | ->withTrashed()
71 | ->first();
72 | if ($newBlockedType === null) {
73 | $newBlockedType = BlockedType::create([
74 | 'slug' => $BlockedType['slug'],
75 | 'name' => $BlockedType['name'],
76 | ]);
77 | }
78 | }
79 | echo "\e[32mSeeding:\e[0m DefaultBlockedTypeTableSeeder\r\n";
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/Database/Seeders/publish/BlockedItemsTableSeeder.php:
--------------------------------------------------------------------------------
1 | 'domain',
25 | 'value' => 'test.com',
26 | 'note' => 'Block all domains/emails @test.com',
27 | ],
28 | [
29 | 'type' => 'domain',
30 | 'value' => 'test.ca',
31 | 'note' => 'Block all domains/emails @test.ca',
32 | ],
33 | [
34 | 'type' => 'domain',
35 | 'value' => 'fake.com',
36 | 'note' => 'Block all domains/emails @fake.com',
37 | ],
38 | [
39 | 'type' => 'domain',
40 | 'value' => 'example.com',
41 | 'note' => 'Block all domains/emails @example.com',
42 | ],
43 | [
44 | 'type' => 'domain',
45 | 'value' => 'mailinator.com',
46 | 'note' => 'Block all domains/emails @mailinator.com',
47 | ],
48 | ];
49 |
50 | /*
51 | * Add Blocked Items
52 | *
53 | */
54 | if (config('laravelblocker.seedPublishedBlockedItems')) {
55 | foreach ($BlockedItems as $BlockedItem) {
56 | $blockType = BlockedType::where('slug', $BlockedItem['type'])->first();
57 | $newBlockedItem = BlockedItem::where('typeId', '=', $blockType->id)
58 | ->where('value', '=', $BlockedItem['value'])
59 | ->withTrashed()
60 | ->first();
61 | if ($newBlockedItem === null) {
62 | $newBlockedItem = BlockedItem::create([
63 | 'typeId' => $blockType->id,
64 | 'value' => $BlockedItem['value'],
65 | 'note' => $BlockedItem['note'],
66 | ]);
67 | }
68 | }
69 | }
70 | echo "\e[32mSeeding:\e[0m BlockedItemsTableSeeder\r\n";
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/Database/Seeders/publish/BlockedTypeTableSeeder.php:
--------------------------------------------------------------------------------
1 | 'email',
24 | 'name' => 'E-mail',
25 | ],
26 | [
27 | 'slug' => 'ipAddress',
28 | 'name' => 'IP Address',
29 | ],
30 | [
31 | 'slug' => 'domain',
32 | 'name' => 'Domain Name',
33 | ],
34 | [
35 | 'slug' => 'user',
36 | 'name' => 'User',
37 | ],
38 | [
39 | 'slug' => 'city',
40 | 'name' => 'City',
41 | ],
42 | [
43 | 'slug' => 'state',
44 | 'name' => 'State',
45 | ],
46 | [
47 | 'slug' => 'country',
48 | 'name' => 'Country',
49 | ],
50 | [
51 | 'slug' => 'countryCode',
52 | 'name' => 'Country Code',
53 | ],
54 | [
55 | 'slug' => 'continent',
56 | 'name' => 'Continent',
57 | ],
58 | [
59 | 'slug' => 'region',
60 | 'name' => 'Region',
61 | ],
62 | ];
63 |
64 | /*
65 | * Add Blocked Types
66 | *
67 | */
68 | if (config('laravelblocker.seedPublishedBlockedTypes')) {
69 | foreach ($BlockedTypes as $BlockedType) {
70 | $newBlockedType = BlockedType::where('slug', '=', $BlockedType['slug'])
71 | ->withTrashed()
72 | ->first();
73 | if ($newBlockedType === null) {
74 | $newBlockedType = BlockedType::create([
75 | 'slug' => $BlockedType['slug'],
76 | 'name' => $BlockedType['name'],
77 | ]);
78 | }
79 | }
80 | }
81 | echo "\e[32mSeeding:\e[0m BlockedTypeTableSeeder\r\n";
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/LaravelBlockerFacade.php:
--------------------------------------------------------------------------------
1 | middlewareGroup('checkblocked', [LaravelBlocker::class]);
30 | $this->loadRoutesFrom(__DIR__.'/routes/web.php');
31 | $this->loadTranslationsFrom(__DIR__.'/resources/lang/', $this->_packageTag);
32 | }
33 |
34 | /**
35 | * Register the application services.
36 | *
37 | * @return void
38 | */
39 | public function register()
40 | {
41 | $this->packageRegistration();
42 | $this->loadRoutesFrom(__DIR__.'/routes/web.php');
43 | $this->loadViewsFrom(__DIR__.'/resources/views/', $this->_packageTag);
44 | $this->mergeConfigFrom(__DIR__.'/config/'.$this->_packageTag.'.php', $this->_packageTag);
45 | $this->loadMigrationsFrom(__DIR__.'/database/migrations');
46 | $this->loadSeedsFrom();
47 | $this->publishFiles();
48 | }
49 |
50 | /**
51 | * Package Registration.
52 | *
53 | * @return void
54 | */
55 | private function packageRegistration()
56 | {
57 | $this->app->make('jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController');
58 | $this->app->singleton(jeremykenedy\LaravelBlocker\App\Http\Controllers\LaravelBlockerController::class, function () {
59 | return new App\Http\Controllers\LaravelBlockerController();
60 | });
61 | $this->app->alias(LaravelBlockerController::class, $this->_packageTag);
62 | }
63 |
64 | /**
65 | * Loads a seeds.
66 | *
67 | * @return void
68 | */
69 | private function loadSeedsFrom()
70 | {
71 | if (config('laravelblocker.seedDefaultBlockedTypes')) {
72 | $this->app['seed.handler']->register(
73 | DefaultBlockedTypeTableSeeder::class
74 | );
75 | }
76 | if (config('laravelblocker.seedDefaultBlockedItems')) {
77 | $this->app['seed.handler']->register(
78 | DefaultBlockedItemsTableSeeder::class
79 | );
80 | }
81 |
82 | if (config('laravelblocker.useSeededBlockedTypes')) {
83 | $this->app['seed.handler']->register(
84 | \Database\Seeders\BlockedTypeTableSeeder::class
85 | );
86 | }
87 |
88 | if (config('laravelblocker.useSeededBlockedItems')) {
89 | $this->app['seed.handler']->register(
90 | \Database\Seeders\BlockedItemsTableSeeder::class
91 | );
92 | }
93 | }
94 |
95 | /**
96 | * Publish files for Laravel Blocker.
97 | *
98 | * @return void
99 | */
100 | private function publishFiles()
101 | {
102 | $publishTag = $this->_packageTag;
103 |
104 | $this->publishes([
105 | __DIR__.'/config/'.$this->_packageTag.'.php' => base_path('config/'.$this->_packageTag.'.php'),
106 | ], $publishTag.'-config');
107 |
108 | $this->publishes([
109 | __DIR__.'/resources/views' => base_path('resources/views/vendor/'.$this->_packageTag),
110 | ], $publishTag.'-views');
111 |
112 | $this->publishes([
113 | __DIR__.'/resources/lang' => base_path('resources/lang/vendor/'.$this->_packageTag),
114 | ], $publishTag.'-lang');
115 |
116 | $this->publishes([
117 | __DIR__.'/database/migrations' => database_path('migrations'),
118 | ], $publishTag.'-migrations');
119 |
120 | $this->publishes([
121 | __DIR__.'/database/seeders/publish' => database_path('seeds'),
122 | ], $publishTag.'-seeds');
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/src/config/laravelblocker.php:
--------------------------------------------------------------------------------
1 | env('LARAVEL_BLOCKER_ENABLED', true),
11 |
12 | /*
13 | |--------------------------------------------------------------------------
14 | | Laravel Blocker Database Settings
15 | |--------------------------------------------------------------------------
16 | */
17 | 'blockerDatabaseConnection' => env('LARAVEL_BLOCKER_DATABASE_CONNECTION', 'mysql'),
18 | 'blockerDatabaseTable' => env('LARAVEL_BLOCKER_DATABASE_TABLE', 'laravel_blocker'),
19 | 'blockerTypeDatabaseTable' => env('LARAVEL_BLOCKER_TYPE_DATABASE_TABLE', 'laravel_blocker_types'),
20 | 'seedDefaultBlockedTypes' => env('LARAVEL_BLOCKER_SEED_DEFAULT_TYPES', true),
21 | 'seedDefaultBlockedItems' => env('LARAVEL_BLOCKER_SEED_DEFAULT_ITEMS', true),
22 | 'seedPublishedBlockedTypes' => env('LARAVEL_BLOCKER_TYPES_SEED_PUBLISHED', true),
23 | 'seedPublishedBlockedItems' => env('LARAVEL_BLOCKER_ITEMS_SEED_PUBLISHED', true),
24 | 'useSeededBlockedTypes' => env('LARAVEL_BLOCKER_USE_TYPES_SEED_PUBLISHED', false),
25 | 'useSeededBlockedItems' => env('LARAVEL_BLOCKER_USE_ITEMS_SEED_PUBLISHED', false),
26 |
27 | /*
28 | |--------------------------------------------------------------------------
29 | | Laravel Default User Model
30 | |--------------------------------------------------------------------------
31 | */
32 | 'defaultUserModel' => env('LARAVEL_BLOCKER_USER_MODEL', 'App\User'),
33 |
34 | /*
35 | |--------------------------------------------------------------------------
36 | | Laravel Blocker Front End Settings
37 | |--------------------------------------------------------------------------
38 | */
39 | // The parent blade file
40 | 'laravelBlockerBladeExtended' => env('LARAVEL_BLOCKER_BLADE_EXTENDED', 'layouts.app'),
41 |
42 | // Titles placement extend
43 | 'laravelBlockerTitleExtended' => env('LARAVEL_BLOCKER_TITLE_EXTENDED', 'template_title'),
44 |
45 | // Switch Between bootstrap 3 `panel` and bootstrap 4 `card` classes
46 | 'blockerBootstapVersion' => env('LARAVEL_BLOCKER_BOOTSTRAP_VERSION', '4'),
47 |
48 | // Additional Card classes for styling -
49 | // See: https://getbootstrap.com/docs/4.0/components/card/#background-and-color
50 | // Example classes: 'text-white bg-primary mb-3'
51 | 'blockerBootstrapCardClasses' => env('LARAVEL_BLOCKER_CARD_CLASSES', ''),
52 |
53 | // Blade Extension Placement
54 | 'blockerBladePlacement' => env('LARAVEL_BLOCKER_BLADE_PLACEMENT', 'yield'),
55 | 'blockerBladePlacementCss' => env('LARAVEL_BLOCKER_BLADE_PLACEMENT_CSS', 'inline_template_linked_css'),
56 | 'blockerBladePlacementJs' => env('LARAVEL_BLOCKER_BLADE_PLACEMENT_JS', 'inline_footer_scripts'),
57 |
58 | // jQuery
59 | 'enablejQueryCDN' => env('LARAVEL_BLOCKER_JQUERY_CDN_ENABLED', true),
60 | 'JQueryCDN' => env('LARAVEL_BLOCKER_JQUERY_CDN_URL', 'https://code.jquery.com/jquery-3.3.1.min.js'),
61 |
62 | // Font Awesome
63 | 'blockerEnableFontAwesomeCDN' => env('LARAVEL_BLOCKER_FONT_AWESOME_CDN_ENABLED', true),
64 | 'blockerFontAwesomeCDN' => env('LARAVEL_BLOCKER_FONT_AWESOME_CDN_URL', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'),
65 |
66 | // Bootstrap Tooltips
67 | 'tooltipsEnabled' => env('LARAVEL_BLOCKER_TOOLTIPS_ENABLED', true),
68 |
69 | // jQuery IP Mask
70 | 'jQueryIpMaskEnabled' => env('LARAVEL_BLOCKER_JQUERY_IP_MASK_ENABLED', true),
71 | 'jQueryIpMaskCDN' => env('LARAVEL_BLOCKER_JQUERY_IP_MASK_CDN', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.js'),
72 |
73 | // Flash Messaging
74 | 'blockerFlashMessagesEnabled' => env('LARAVEL_BLOCKER_FLASH_MESSAGES_ENABLED', true),
75 |
76 | // Enable Search Blocked - Uses jQuery Ajax
77 | 'enableSearchBlocked' => env('LARAVEL_BLOCKER_SEARCH_ENABLED', true),
78 |
79 | /*
80 | |--------------------------------------------------------------------------
81 | | Laravel Blocker Auth & Roles Settings
82 | |--------------------------------------------------------------------------
83 | */
84 | // Enable `auth` middleware
85 | 'authEnabled' => env('LARAVEL_BLOCKER_AUTH_ENABLED', true),
86 |
87 | // Enable Optional Roles Middleware
88 | 'rolesEnabled' => env('LARAVEL_BLOCKER_ROLES_ENABLED', false),
89 |
90 | // Optional Roles Middleware
91 | 'rolesMiddlware' => env('LARAVEL_BLOCKER_ROLES_MIDDLWARE', 'role:admin'),
92 |
93 | /*
94 | |--------------------------------------------------------------------------
95 | | Laravel Blocker Pagination Settings
96 | |--------------------------------------------------------------------------
97 | */
98 | 'blockerPaginationEnabled' => env('LARAVEL_BLOCKER_PAGINATION_ENABLED', false),
99 | 'blockerPaginationPerPage' => env('LARAVEL_BLOCKER_PAGINATION_PER_PAGE', 25),
100 |
101 | /*
102 | |--------------------------------------------------------------------------
103 | | Laravel Blocker Databales Settings - Not recommended with pagination.
104 | |--------------------------------------------------------------------------
105 | */
106 | 'blockerDatatables' => env('LARAVEL_BLOCKER_DATATABLES_ENABLED', false),
107 | 'enabledDatatablesJs' => env('LARAVEL_BLOCKER_DATATABLES_JS_ENABLED', false),
108 | 'datatablesJsStartCount' => env('LARAVEL_BLOCKER_DATATABLES_JS_START_COUNT', 25),
109 | 'datatablesCssCDN' => env('LARAVEL_BLOCKER_DATATABLES_CSS_CDN', 'https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css'),
110 | 'datatablesJsCDN' => env('LARAVEL_BLOCKER_DATATABLES_JS_CDN', 'https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js'),
111 | 'datatablesJsPresetCDN' => env('LARAVEL_BLOCKER_DATATABLES_JS_PRESET_CDN', 'https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js'),
112 |
113 | /*
114 | |--------------------------------------------------------------------------
115 | | Laravel Blocker Actions Options
116 | |--------------------------------------------------------------------------
117 | */
118 | 'blockerDefaultAction' => env('LARAVEL_BLOCKER_DEFAULT_ACTION', 'abort'), //'abort', 'view' ,'redirect'
119 | 'blockerDefaultActionAbortType' => env('LARAVEL_BLOCKER_DEFAULT_ACTION_ABORT_TYPE', '403'),
120 | 'blockerDefaultActionView' => env('LARAVEL_BLOCKER_DEFAULT_ACTION_VIEW', 'welcome'),
121 | 'blockerDefaultActionRedirect' => env('LARAVEL_BLOCKER_DEFAULT_ACTION_REDIRECT', '/'), // Internal or external
122 | ];
123 |
--------------------------------------------------------------------------------
/src/resources/lang/en/laravelblocker.php:
--------------------------------------------------------------------------------
1 | 'Blocked Items',
12 | 'blocked-item-title' => 'Blocked Item: :name',
13 | 'blocked-item-deleted-title' => 'Deleted Blocked Item: :name',
14 | 'edit-blocked-item-title' => 'Editing Item: :name',
15 | 'blocked-items-deleted-title' => 'Deleted Blocked Items',
16 |
17 | 'na' => 'N/A',
18 | 'none' => 'None',
19 |
20 | 'titles' => [
21 | 'show-blocked' => 'Blocked Items',
22 | 'show-blocked-item' => 'Blocked Item',
23 | 'create-blocked' => 'Create Blocked Item',
24 | ],
25 |
26 | 'buttons' => [
27 | 'create-new-blocked' => 'Create New',
28 | 'show-deleted-blocked' => 'Show Deleted',
29 | 'back-to-blocked' => 'Back to Blocked',
30 | 'back-to-blocked-deleted' => 'Back to Deleted',
31 | 'show' => 'Show ',
32 | 'edit' => 'Edit ',
33 | 'delete' => 'Delete ',
34 | 'destroy' => 'Destroy ',
35 | 'save-larger' => 'Save Edits ',
36 | 'create-larger' => 'Create New Blocked Item ',
37 | 'show-larger' => 'Show ',
38 | 'edit-larger' => 'Edit ',
39 | 'delete-larger' => 'Delete ',
40 | 'destroy-larger' => 'Destroy ',
41 | 'destroy-all' => '{1} Destroy :count Blocked Item|[2,*] Destroy All :count Blocked Items',
42 | 'restore-all-blocked' => '{1} Restore :count Blocked Item|[2,*] Restore All :count Blocked Items',
43 | 'restore-blocked-item' => 'Restore ',
44 | 'restore-blocked-item-full' => 'Restore ',
45 | ],
46 |
47 | 'tooltips' => [
48 | 'delete' => 'Delete Blocked Item',
49 | 'show' => 'Show Blocked Item',
50 | 'edit' => 'Edit Blocked Item',
51 | 'create-new' => 'Create New Blocked',
52 | 'back-blocked' => 'Back to blocked',
53 | 'back-blocked-deleted' => 'Back to deleted blocked',
54 | 'submit-search' => 'Submit Blocked Search',
55 | 'clear-search' => 'Clear Search Results',
56 | 'destroy_blocked_tooltip' => 'Destroy Blocked Item',
57 | 'restoreItem' => 'Restore Blocked Item',
58 | ],
59 |
60 | 'blocked-table' => [
61 | 'caption' => '{1} :blockedcount block total|[2,*] :blockedcount total blocks',
62 | 'id' => 'ID',
63 | 'type' => 'Type',
64 | 'value' => 'Value',
65 | 'note' => 'Note',
66 | 'userId' => 'UserID',
67 | 'createdAt' => 'Created',
68 | 'updatedAt' => 'Updated',
69 | 'deletedAt' => 'Deleted',
70 | 'actions' => 'Actions',
71 | 'none' => 'No Blocked Items',
72 | ],
73 |
74 | 'forms' => [
75 | 'search-blocked-ph' => 'Search Blocked',
76 | 'blockedTypeLabel' => 'Blocked Type',
77 | 'blockedTypeSelect' => 'Select Blocked Type',
78 | 'blockedValueLabel' => 'Blocked Value',
79 | 'blockedValuePH' => 'Blocked Value',
80 | 'blockedNoteLabel' => 'Blocked Note',
81 | 'blockedNotePH' => 'Type Blocked Note',
82 | 'blockedUserLabel' => 'Blocked User',
83 | 'blockedUserSelect' => 'Select Blocked User',
84 | ],
85 |
86 | 'search' => [
87 | 'title' => 'Showing Search Results',
88 | 'title-deleted' => 'Showing Deleted Search Results',
89 | 'found-footer' => ' Record(s) found',
90 | 'no-results' => 'No Results',
91 | 'search-users-ph' => 'Search Blocked',
92 | 'required' => 'Search term is required',
93 | 'string' => 'Search term has invalid characters',
94 | 'max' => 'Search term has too many characters - 255 allowed',
95 | ],
96 |
97 | 'modals' => [
98 | 'delete_blocked_title' => 'Delete blocked item',
99 | 'destroy_blocked_title' => 'Destroy Blocked Item',
100 | 'delete_blocked_message' => 'Are you sure you want to delete :blocked?',
101 | 'destroy_blocked_message' => 'Are you sure you want to DESTROY :blocked?',
102 | 'delete_blocked_btn_cancel' => 'Cancel',
103 | 'delete_blocked_btn_confirm' => 'Confirm Delete',
104 | 'destroy_all_blocked_title' => 'Destroy ALL Blocked Items',
105 | 'destroy_all_blocked_message' => 'Are you sure you want to DESTROY ALL blocked items?',
106 | 'resotreAllBlockedTitle' => 'Restore ALL Blocked Items',
107 | 'resotreAllBlockedMessage' => 'Are you sure you want to RESTORE ALL blocked items?',
108 | 'resotreBlockedItemTitle' => 'Restore Blocked Item',
109 | 'resotreBlockedItemMessage' => 'Are you sure you want to RESTORE :value?',
110 | 'btnConfirm' => 'Confirm',
111 | 'btnCancel' => 'Cancel',
112 | ],
113 |
114 | 'messages' => [
115 | 'blocked-creation-success' => 'Successfully created blocked item.',
116 | 'delete-success' => 'Successfully deleted blocked item.',
117 | 'update-success' => 'Successfully updated blocked item.',
118 | 'successRestoredItem' => 'Successfully restored blocked item.',
119 | 'successRestoredAllItems' => 'Successfully restored all blocked items.',
120 | 'successDestroyedItem' => 'Successfully destroyed blocked item.',
121 | 'successDestroyedAllItems' => 'Successfully destroyed all blocked items.',
122 | ],
123 |
124 | 'validation' => [
125 | 'blockedTypeRequired' => 'Blocked Type is required.',
126 | 'blockedValueRequired' => 'Blocked Value is required.',
127 | 'blockedExists' => 'The :attribute already exists.',
128 | 'email' => 'Must be a valid formed email address.',
129 | ],
130 |
131 | 'errors' => [
132 | 'errorBlockerNotFound' => 'Blocked item not found.',
133 | ],
134 |
135 | 'flash-messages' => [
136 | 'close' => 'Close',
137 | 'success' => 'Success',
138 | 'error' => 'Error',
139 | 'whoops' => 'Whoops! ',
140 | 'someProblems' => 'There were some problems with your input.',
141 |
142 | ],
143 |
144 | ];
145 |
--------------------------------------------------------------------------------
/src/resources/views/forms/create-new.blade.php:
--------------------------------------------------------------------------------
1 | {!! Form::open([
2 | 'route' => 'laravelblocker::blocker.store',
3 | 'method' => 'POST',
4 | 'role' => 'form',
5 | 'class' => 'needs-validation'
6 | ]) !!}
7 | {!! csrf_field() !!}
8 | @include('laravelblocker::forms.partials.item-type-select')
9 | @include('laravelblocker::forms.partials.item-value-input')
10 | @include('laravelblocker::forms.partials.item-blocked-user-select')
11 | @include('laravelblocker::forms.partials.item-note-input')
12 |
13 |
14 | {!! Form::button(trans('laravelblocker::laravelblocker.buttons.create-larger'), array('class' => 'btn btn-success btn-block margin-bottom-1 mb-1 float-right','type' => 'submit' )) !!}
15 |
16 |
17 | {!! Form::close() !!}
18 |
--------------------------------------------------------------------------------
/src/resources/views/forms/delete-full.blade.php:
--------------------------------------------------------------------------------
1 | {!! Form::open([
2 | 'route' => ['laravelblocker::blocker.destroy', $item->id],
3 | 'method' => 'DELETE',
4 | 'accept-charset' => 'UTF-8',
5 | 'data-toggle' => 'tooltip',
6 | 'title' => trans('laravelblocker::laravelblocker.tooltips.delete')
7 | ]) !!}
8 | {!! Form::hidden("_method", "DELETE") !!}
9 | {!! csrf_field() !!}
10 |
13 | {!! Form::close() !!}
14 |
--------------------------------------------------------------------------------
/src/resources/views/forms/delete-item.blade.php:
--------------------------------------------------------------------------------
1 | {!! Form::open([
2 | 'route' => ['laravelblocker::blocker.destroy', $item->id],
3 | 'method' => 'DELETE',
4 | 'accept-charset' => 'UTF-8',
5 | 'data-toggle' => 'tooltip',
6 | 'title' => trans('laravelblocker::laravelblocker.tooltips.delete')
7 | ]) !!}
8 | {!! Form::hidden("_method", "DELETE") !!}
9 | {!! csrf_field() !!}
10 |
13 | {!! Form::close() !!}
14 |
--------------------------------------------------------------------------------
/src/resources/views/forms/delete-sm.blade.php:
--------------------------------------------------------------------------------
1 | {!! Form::open([
2 | 'route' => ['laravelblocker::blocker.destroy', $blockedItem->id],
3 | 'method' => 'DELETE',
4 | 'accept-charset' => 'UTF-8',
5 | 'data-toggle' => 'tooltip',
6 | 'title' => trans('laravelblocker::laravelblocker.tooltips.delete')
7 | ]) !!}
8 | {!! Form::hidden("_method", "DELETE") !!}
9 | {!! csrf_field() !!}
10 |
13 | {!! Form::close() !!}
14 |
--------------------------------------------------------------------------------
/src/resources/views/forms/destroy-all.blade.php:
--------------------------------------------------------------------------------
1 | {!! Form::open([
2 | 'route' => 'laravelblocker::destroy-all-blocked',
3 | 'method' => 'DELETE',
4 | 'accept-charset' => 'UTF-8'
5 | ]) !!}
6 | {!! Form::hidden("_method", "DELETE") !!}
7 | {!! csrf_field() !!}
8 |
11 | {!! Form::close() !!}
12 |
--------------------------------------------------------------------------------
/src/resources/views/forms/destroy-full.blade.php:
--------------------------------------------------------------------------------
1 | {!! Form::open([
2 | 'route' => ['laravelblocker::blocker-item-destroy', $item->id],
3 | 'method' => 'DELETE',
4 | 'accept-charset' => 'UTF-8',
5 | 'data-toggle' => 'tooltip',
6 | 'title' => trans("laravelblocker::laravelblocker.tooltips.destroy_blocked_tooltip")
7 | ]) !!}
8 | {!! Form::hidden("_method", "DELETE") !!}
9 | {!! csrf_field() !!}
10 |
13 | {!! Form::close() !!}
14 |
--------------------------------------------------------------------------------
/src/resources/views/forms/destroy-sm.blade.php:
--------------------------------------------------------------------------------
1 | {!! Form::open([
2 | 'route' => ['laravelblocker::blocker-item-destroy', $blockedItem->id],
3 | 'method' => 'DELETE',
4 | 'accept-charset' => 'UTF-8',
5 | 'data-toggle' => 'tooltip',
6 | 'title' => trans("laravelblocker::laravelblocker.tooltips.destroy_blocked_tooltip")
7 | ]) !!}
8 | {!! Form::hidden("_method", "DELETE") !!}
9 | {!! csrf_field() !!}
10 |
13 | {!! Form::close() !!}
14 |
--------------------------------------------------------------------------------
/src/resources/views/forms/edit-form.blade.php:
--------------------------------------------------------------------------------
1 | {!! Form::open([
2 | 'route' => ['laravelblocker::blocker.update', $item->id],
3 | 'method' => 'PUT',
4 | 'role' => 'form',
5 | 'class' => 'needs-validation'
6 | ]) !!}
7 | {!! csrf_field() !!}
8 | @include('laravelblocker::forms.partials.item-type-select')
9 | @include('laravelblocker::forms.partials.item-value-input')
10 | @include('laravelblocker::forms.partials.item-blocked-user-select')
11 | @include('laravelblocker::forms.partials.item-note-input')
12 |
13 |
14 | {!! Form::button(trans('laravelblocker::laravelblocker.buttons.save-larger'), array('class' => 'btn btn-success btn-block margin-bottom-1 mb-1 float-right','type' => 'submit' )) !!}
15 |
16 |
17 | {!! Form::close() !!}
18 |
19 |
20 | @include('laravelblocker::forms.delete-full')
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/resources/views/forms/partials/item-blocked-user-select.blade.php:
--------------------------------------------------------------------------------
1 |
30 |
--------------------------------------------------------------------------------
/src/resources/views/forms/partials/item-note-input.blade.php:
--------------------------------------------------------------------------------
1 |
23 |
--------------------------------------------------------------------------------
/src/resources/views/forms/partials/item-type-select.blade.php:
--------------------------------------------------------------------------------
1 |
30 |
--------------------------------------------------------------------------------
/src/resources/views/forms/partials/item-value-input.blade.php:
--------------------------------------------------------------------------------
1 |
23 |
--------------------------------------------------------------------------------
/src/resources/views/forms/restore-all.blade.php:
--------------------------------------------------------------------------------
1 | {!! Form::open([
2 | 'route' => 'laravelblocker::blocker-deleted-restore-all',
3 | 'method' => 'POST',
4 | 'accept-charset' => 'UTF-8'
5 | ]) !!}
6 | {!! csrf_field() !!}
7 | {!! Form::button('
8 | ' . trans_choice('laravelblocker::laravelblocker.buttons.restore-all-blocked', 1, ['count' => $blocked->count()]),
9 | [
10 | 'type' => 'button',
11 | 'class' => 'btn dropdown-item',
12 | 'data-toggle' => 'modal',
13 | 'data-target' => '#confirmRestore',
14 | 'data-title' => trans('laravelblocker::laravelblocker.modals.resotreAllBlockedTitle'),
15 | 'data-message' => trans('laravelblocker::laravelblocker.modals.resotreAllBlockedMessage')
16 | ]) !!}
17 | {!! Form::close() !!}
18 |
--------------------------------------------------------------------------------
/src/resources/views/forms/restore-item.blade.php:
--------------------------------------------------------------------------------
1 | @if($restoreType == 'full')
2 | @php
3 | $itemId = $item->id;
4 | $itemValue = $item->value;
5 | $itemClasses = 'btn btn-success btn-block';
6 | $itemText = trans('laravelblocker::laravelblocker.buttons.restore-blocked-item-full');
7 | @endphp
8 | @endif
9 | @if($restoreType == 'small')
10 | @php
11 | $itemId = $blockedItem->id;
12 | $itemValue = $blockedItem->value;
13 | $itemClasses = 'btn btn-sm btn-success btn-block';
14 | $itemText = trans('laravelblocker::laravelblocker.buttons.restore-blocked-item');
15 | @endphp
16 | @endif
17 |
18 | {!! Form::open([
19 | 'route' => ['laravelblocker::blocker-item-restore', $itemId],
20 | 'method' => 'PUT',
21 | 'accept-charset' => 'UTF-8',
22 | 'data-toggle' => 'tooltip',
23 | 'title' => trans("laravelblocker::laravelblocker.tooltips.restoreItem")
24 | ]) !!}
25 | {!! Form::hidden("_method", "PUT") !!}
26 | {!! csrf_field() !!}
27 | {!! Form::button($itemText, [
28 | 'type' => 'button',
29 | 'class' => $itemClasses,
30 | 'data-toggle' => 'modal',
31 | 'data-target' => '#confirmRestore',
32 | 'data-title' => trans('laravelblocker::laravelblocker.modals.resotreBlockedItemTitle'),
33 | 'data-message' => trans('laravelblocker::laravelblocker.modals.resotreBlockedItemMessage', ['value' => $itemValue])
34 | ]) !!}
35 | {!! Form::close() !!}
36 |
--------------------------------------------------------------------------------
/src/resources/views/forms/search-blocked.blade.php:
--------------------------------------------------------------------------------
1 |
36 |
--------------------------------------------------------------------------------
/src/resources/views/laravelblocker/create.blade.php:
--------------------------------------------------------------------------------
1 | @extends(config('laravelblocker.laravelBlockerBladeExtended'))
2 |
3 | @section(config('laravelblocker.laravelBlockerTitleExtended'))
4 | {!! trans('laravelblocker::laravelblocker.titles.create-blocked') !!}
5 | @endsection
6 |
7 | @php
8 | switch (config('laravelblocker.blockerBootstapVersion')) {
9 | case '4':
10 | $containerClass = 'card';
11 | $containerHeaderClass = 'card-header bg-warning text-white';
12 | $containerBodyClass = 'card-body';
13 | break;
14 | case '3':
15 | default:
16 | $containerClass = 'panel panel-warning';
17 | $containerHeaderClass = 'panel-heading';
18 | $containerBodyClass = 'panel-body';
19 | }
20 | $blockerBootstrapCardClasses = (is_null(config('laravelblocker.blockerBootstrapCardClasses')) ? '' : config('laravelblocker.blockerBootstrapCardClasses'));
21 | @endphp
22 |
23 | @section(config('laravelblocker.blockerBladePlacementCss'))
24 | @if(config('laravelblocker.blockerEnableFontAwesomeCDN'))
25 |
26 | @endif
27 | @include('laravelblocker::partials.styles')
28 | @include('laravelblocker::partials.bs-visibility-css')
29 | @endsection
30 |
31 | @section('content')
32 |
33 | @include('laravelblocker::partials.flash-messages')
34 |
35 |
36 |
37 |
38 |
39 |
50 |
51 | @include('laravelblocker::forms.create-new')
52 |
53 |
54 |
55 |
56 |
57 |
58 | @endsection
59 |
60 | @section(config('laravelblocker.blockerBladePlacementJs'))
61 | @if(config('laravelblocker.enablejQueryCDN'))
62 |
63 | @endif
64 | @if(config('laravelblocker.tooltipsEnabled'))
65 | @include('laravelblocker::scripts.tooltips')
66 | @endif
67 | @include('laravelblocker::scripts.blocked-form')
68 | @endsection
69 |
70 | @yield('inline_template_linked_css')
71 | @yield('inline_footer_scripts')
72 |
--------------------------------------------------------------------------------
/src/resources/views/laravelblocker/deleted/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends(config('laravelblocker.laravelBlockerBladeExtended'))
2 |
3 | @section(config('laravelblocker.laravelBlockerTitleExtended'))
4 | {!! trans('laravelblocker::laravelblocker.titles.show-blocked') !!}
5 | @endsection
6 |
7 | @php
8 | switch (config('laravelblocker.blockerBootstapVersion')) {
9 | case '4':
10 | $containerClass = 'card';
11 | $containerHeaderClass = 'card-header bg-danger text-white';
12 | $containerBodyClass = 'card-body';
13 | break;
14 | case '3':
15 | default:
16 | $containerClass = 'panel panel-danger';
17 | $containerHeaderClass = 'panel-heading';
18 | $containerBodyClass = 'panel-body';
19 | }
20 | $blockerBootstrapCardClasses = (is_null(config('laravelblocker.blockerBootstrapCardClasses')) ? '' : config('laravelblocker.blockerBootstrapCardClasses'));
21 | @endphp
22 |
23 | @section(config('laravelblocker.blockerBladePlacementCss'))
24 | @if(config('laravelblocker.enabledDatatablesJs'))
25 |
26 | @endif
27 | @if(config('laravelblocker.blockerEnableFontAwesomeCDN'))
28 |
29 | @endif
30 | @include('laravelblocker::partials.styles')
31 | @include('laravelblocker::partials.bs-visibility-css')
32 | @endsection
33 |
34 | @section('content')
35 |
36 | @include('laravelblocker::partials.flash-messages')
37 |
38 |
39 |
40 |
41 |
42 |
67 |
68 | @if(config('laravelblocker.enableSearchBlocked'))
69 | @include('laravelblocker::forms.search-blocked')
70 | @endif
71 | @include('laravelblocker::partials.blocked-items-table', ['tabletype' => 'deleted'])
72 |
73 |
74 |
75 |
76 |
77 |
78 | @include('laravelblocker::modals.confirm-modal', [
79 | 'formTrigger' => 'confirmDelete',
80 | 'modalClass' => 'danger',
81 | 'actionBtnIcon' => 'fa-trash-o'
82 | ])
83 |
84 | @include('laravelblocker::modals.confirm-modal',[
85 | 'formTrigger' => 'confirmRestore',
86 | 'modalClass' => 'success',
87 | 'actionBtnIcon' => 'fa-check'
88 | ])
89 |
90 | @endsection
91 |
92 | @section(config('laravelblocker.blockerBladePlacementJs'))
93 | @if(config('laravelblocker.enablejQueryCDN'))
94 |
95 | @endif
96 | @if (config('laravelblocker.enabledDatatablesJs'))
97 | @include('laravelblocker::scripts.datatables')
98 | @endif
99 |
100 | @include('laravelblocker::scripts.confirm-modal', ['formTrigger' => '#confirmDelete'])
101 | @include('laravelblocker::scripts.confirm-modal', ['formTrigger' => '#confirmRestore'])
102 |
103 | @if(config('laravelblocker.tooltipsEnabled'))
104 | @include('laravelblocker::scripts.tooltips')
105 | @endif
106 | @if(config('laravelblocker.enableSearchBlocked'))
107 | @include('laravelblocker::scripts.search-blocked', ['searchtype' => 'deleted'])
108 | @endif
109 | @endsection
110 |
111 | @yield('inline_template_linked_css')
112 | @yield('inline_footer_scripts')
113 |
--------------------------------------------------------------------------------
/src/resources/views/laravelblocker/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends(config('laravelblocker.laravelBlockerBladeExtended'))
2 |
3 | @section(config('laravelblocker.laravelBlockerTitleExtended'))
4 | {!! trans('laravelblocker::laravelblocker.titles.show-blocked-item') !!}
5 | @endsection
6 |
7 | @php
8 | switch (config('laravelblocker.blockerBootstapVersion')) {
9 | case '4':
10 | $containerClass = 'card';
11 | $containerHeaderClass = 'card-header bg-warning text-white';
12 | $containerBodyClass = 'card-body';
13 | break;
14 | case '3':
15 | default:
16 | $containerClass = 'panel panel-warning';
17 | $containerHeaderClass = 'panel-heading';
18 | $containerBodyClass = 'panel-body';
19 | }
20 | $blockerBootstrapCardClasses = (is_null(config('laravelblocker.blockerBootstrapCardClasses')) ? '' : config('laravelblocker.blockerBootstrapCardClasses'));
21 | @endphp
22 |
23 | @section(config('laravelblocker.blockerBladePlacementCss'))
24 | @if(config('laravelblocker.blockerEnableFontAwesomeCDN'))
25 |
26 | @endif
27 | @include('laravelblocker::partials.styles')
28 | @include('laravelblocker::partials.bs-visibility-css')
29 | @endsection
30 |
31 | @section('content')
32 |
33 | @include('laravelblocker::partials.flash-messages')
34 |
35 |
36 |
37 |
38 |
39 |
52 |
53 | @include('laravelblocker::forms.edit-form')
54 |
55 |
56 |
57 |
58 |
59 |
60 | @include('laravelblocker::modals.confirm-modal',[
61 | 'formTrigger' => 'confirmDelete',
62 | 'modalClass' => 'danger',
63 | 'actionBtnIcon' => 'fa-trash-o'
64 | ])
65 |
66 | @endsection
67 |
68 | @section(config('laravelblocker.blockerBladePlacementJs'))
69 | @if(config('laravelblocker.enablejQueryCDN'))
70 |
71 | @endif
72 | @include('laravelblocker::scripts.confirm-modal', ['formTrigger' => '#confirmDelete'])
73 | @if(config('laravelblocker.tooltipsEnabled'))
74 | @include('laravelblocker::scripts.tooltips')
75 | @endif
76 | @include('laravelblocker::scripts.blocked-form')
77 | @endsection
78 |
79 | @yield('inline_template_linked_css')
80 | @yield('inline_footer_scripts')
81 |
--------------------------------------------------------------------------------
/src/resources/views/laravelblocker/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends(config('laravelblocker.laravelBlockerBladeExtended'))
2 |
3 | @section(config('laravelblocker.laravelBlockerTitleExtended'))
4 | {!! trans('laravelblocker::laravelblocker.titles.show-blocked') !!}
5 | @endsection
6 |
7 | @php
8 | switch (config('laravelblocker.blockerBootstapVersion')) {
9 | case '4':
10 | $containerClass = 'card';
11 | $containerHeaderClass = 'card-header bg-warning text-white';
12 | $containerBodyClass = 'card-body';
13 | break;
14 | case '3':
15 | default:
16 | $containerClass = 'panel panel-warning';
17 | $containerHeaderClass = 'panel-heading';
18 | $containerBodyClass = 'panel-body';
19 | }
20 | $blockerBootstrapCardClasses = (is_null(config('laravelblocker.blockerBootstrapCardClasses')) ? '' : config('laravelblocker.blockerBootstrapCardClasses'));
21 | @endphp
22 |
23 | @section(config('laravelblocker.blockerBladePlacementCss'))
24 | @if(config('laravelblocker.enabledDatatablesJs'))
25 |
26 | @endif
27 | @if(config('laravelblocker.blockerEnableFontAwesomeCDN'))
28 |
29 | @endif
30 | @include('laravelblocker::partials.styles')
31 | @include('laravelblocker::partials.bs-visibility-css')
32 | @endsection
33 |
34 | @section('content')
35 |
36 | @include('laravelblocker::partials.flash-messages')
37 |
38 |
39 |
40 |
41 |
42 |
72 |
73 | @if(config('laravelblocker.enableSearchBlocked'))
74 | @include('laravelblocker::forms.search-blocked')
75 | @endif
76 |
77 | @include('laravelblocker::partials.blocked-items-table', ['tabletype' => 'normal'])
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | @include('laravelblocker::modals.confirm-modal',[
86 | 'formTrigger' => 'confirmDelete',
87 | 'modalClass' => 'danger',
88 | 'actionBtnIcon' => 'fa-trash-o'
89 | ])
90 |
91 | @endsection
92 |
93 | @section(config('laravelblocker.blockerBladePlacementJs'))
94 | @if(config('laravelblocker.enablejQueryCDN'))
95 |
96 | @endif
97 | @if (config('laravelblocker.enabledDatatablesJs'))
98 | @include('laravelblocker::scripts.datatables')
99 | @endif
100 | @include('laravelblocker::scripts.confirm-modal', ['formTrigger' => '#confirmDelete'])
101 | @if(config('laravelblocker.tooltipsEnabled'))
102 | @include('laravelblocker::scripts.tooltips')
103 | @endif
104 | @if(config('laravelblocker.enableSearchBlocked'))
105 | @include('laravelblocker::scripts.search-blocked', ['searchtype' => 'normal'])
106 | @endif
107 | @endsection
108 |
109 | @yield('inline_template_linked_css')
110 | @yield('inline_footer_scripts')
111 |
--------------------------------------------------------------------------------
/src/resources/views/laravelblocker/show.blade.php:
--------------------------------------------------------------------------------
1 | @extends(config('laravelblocker.laravelBlockerBladeExtended'))
2 |
3 | @section(config('laravelblocker.laravelBlockerTitleExtended'))
4 | {!! trans('laravelblocker::laravelblocker.titles.show-blocked-item') !!}
5 | @endsection
6 |
7 | @php
8 | switch (config('laravelblocker.blockerBootstapVersion')) {
9 | case '4':
10 | $containerClass = 'card';
11 | $containerHeaderClass = 'card-header bg-warning text-white';
12 | if(isset($typeDeleted)) {
13 | $containerHeaderClass = 'card-header bg-danger text-white';
14 | }
15 | $containerBodyClass = 'card-body';
16 | break;
17 | case '3':
18 | default:
19 | $containerClass = 'panel panel-warning';
20 | if(isset($typeDeleted)) {
21 | $containerClass = 'panel panel-danger';
22 | }
23 | $containerHeaderClass = 'panel-heading';
24 | $containerBodyClass = 'panel-body';
25 | }
26 | $blockerBootstrapCardClasses = (is_null(config('laravelblocker.blockerBootstrapCardClasses')) ? '' : config('laravelblocker.blockerBootstrapCardClasses'));
27 | @endphp
28 |
29 | @section(config('laravelblocker.blockerBladePlacementCss'))
30 | @if(config('laravelblocker.blockerEnableFontAwesomeCDN'))
31 |
32 | @endif
33 | @include('laravelblocker::partials.styles')
34 | @include('laravelblocker::partials.bs-visibility-css')
35 | @endsection
36 |
37 | @section('content')
38 |
39 | @include('laravelblocker::partials.flash-messages')
40 |
41 |
42 |
43 |
44 |
45 |
69 |
70 |
71 | -
72 | ID
73 |
74 | {{ $item->id }}
75 |
76 |
77 | -
78 | TypeId
79 |
80 | {{ $item->typeId }}
81 |
82 |
83 | -
84 | Slug
85 |
86 | {!! $item->blockedType->slug !!}
87 |
88 |
89 | -
90 | Value
91 |
92 | {{ $item->value }}
93 |
94 |
95 | -
96 | Note
97 |
98 | {{ $item->note }}
99 |
100 |
101 | -
102 | UserId
103 |
104 | @if ($item->userId)
105 | {!! $item->userId !!}
106 | @else
107 |
108 | {!! trans('laravelblocker::laravelblocker.none') !!}
109 |
110 | @endif
111 |
112 |
113 | -
114 | Created At
115 |
116 | {!! $item->created_at->format('m/d/Y H:ia') !!}
117 |
118 |
119 | -
120 | Updated At
121 |
122 | {!! $item->updated_at->format('m/d/Y H:ia') !!}
123 |
124 |
125 | @if ($item->deleted_at)
126 | -
127 | Deleted At
128 |
129 | {!! $item->deleted_at->format('m/d/Y H:ia') !!}
130 |
131 |
132 | @endif
133 |
134 |
135 |
144 |
145 | @isset($typeDeleted)
146 | @include('laravelblocker::forms.destroy-full')
147 | @else
148 | @include('laravelblocker::forms.delete-item')
149 | @endisset
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 | @include('laravelblocker::modals.confirm-modal',[
159 | 'formTrigger' => 'confirmRestore',
160 | 'modalClass' => 'success',
161 | 'actionBtnIcon' => 'fa-check'
162 | ])
163 |
164 | @include('laravelblocker::modals.confirm-modal',[
165 | 'formTrigger' => 'confirmDelete',
166 | 'modalClass' => 'danger',
167 | 'actionBtnIcon' => 'fa-trash-o'
168 | ])
169 |
170 | @endsection
171 |
172 | @section(config('laravelblocker.blockerBladePlacementJs'))
173 | @if(config('laravelblocker.enablejQueryCDN'))
174 |
175 | @endif
176 | @include('laravelblocker::scripts.confirm-modal', ['formTrigger' => '#confirmDelete'])
177 | @include('laravelblocker::scripts.confirm-modal', ['formTrigger' => '#confirmRestore'])
178 | @if(config('laravelblocker.tooltipsEnabled'))
179 | @include('laravelblocker::scripts.tooltips')
180 | @endif
181 | @endsection
182 |
183 | @yield('inline_template_linked_css')
184 | @yield('inline_footer_scripts')
185 |
--------------------------------------------------------------------------------
/src/resources/views/modals/confirm-modal.blade.php:
--------------------------------------------------------------------------------
1 | @php
2 | if (!isset($actionBtnIcon)) {
3 | $actionBtnIcon = null;
4 | } else {
5 | $actionBtnIcon = $actionBtnIcon . ' fa-fw';
6 | }
7 | if (!isset($modalClass)) {
8 | $modalClass = null;
9 | }
10 | if (!isset($btnSubmitText)) {
11 | $btnSubmitText = trans('laravelblocker::laravelblocker.modals.btnConfirm');
12 | }
13 | @endphp
14 |
35 |
--------------------------------------------------------------------------------
/src/resources/views/partials/blocked-items-table.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {!! trans_choice('laravelblocker::laravelblocker.blocked-table.caption', 1, ['blockedcount' => $blocked->count()]) !!}
5 |
6 |
7 |
8 |
9 | {!! trans('laravelblocker::laravelblocker.blocked-table.id') !!}
10 | |
11 |
12 | {!! trans('laravelblocker::laravelblocker.blocked-table.type') !!}
13 | |
14 |
15 | {!! trans('laravelblocker::laravelblocker.blocked-table.value') !!}
16 | |
17 |
18 | {!! trans('laravelblocker::laravelblocker.blocked-table.note') !!}
19 | |
20 |
21 | {!! trans('laravelblocker::laravelblocker.blocked-table.userId') !!}
22 | |
23 |
24 | {!! trans('laravelblocker::laravelblocker.blocked-table.createdAt') !!}
25 | |
26 |
27 | {!! trans('laravelblocker::laravelblocker.blocked-table.updatedAt') !!}
28 | |
29 | @if($tabletype == 'deleted')
30 |
31 | {!! trans('laravelblocker::laravelblocker.blocked-table.deletedAt') !!}
32 | |
33 | @endif
34 |
35 | {!! trans('laravelblocker::laravelblocker.blocked-table.actions') !!}
36 | |
37 |
38 |
39 |
40 | @if($blocked->count() > 0)
41 | @foreach($blocked as $blockedItem)
42 |
43 |
44 | {!! $blockedItem->id !!}
45 | |
46 |
47 | {!! $blockedItem->blockedType->slug !!}
48 | |
49 |
50 | {!! $blockedItem->value !!}
51 | |
52 |
53 | {!! $blockedItem->note !!}
54 | |
55 |
56 | @if ($blockedItem->userId)
57 | {!! $blockedItem->userId !!}
58 | @else
59 |
60 | {!! trans('laravelblocker::laravelblocker.none') !!}
61 |
62 | @endif
63 | |
64 |
65 | {!! $blockedItem->created_at->format('m/d/Y H:ia') !!}
66 | |
67 |
68 | {!! $blockedItem->updated_at->format('m/d/Y H:ia') !!}
69 | |
70 | @if($tabletype == 'deleted')
71 |
72 | {!! $blockedItem->deleted_at->format('m/d/Y H:ia') !!}
73 | |
74 | @endif
75 | @if($tabletype == 'normal')
76 |
77 |
78 | {!! trans("laravelblocker::laravelblocker.buttons.show") !!}
79 |
80 | |
81 |
82 |
83 | {!! trans("laravelblocker::laravelblocker.buttons.edit") !!}
84 |
85 | |
86 |
87 | @include('laravelblocker::forms.delete-sm')
88 | |
89 | @endif
90 | @if($tabletype == 'deleted')
91 |
92 |
93 | {!! trans("laravelblocker::laravelblocker.buttons.show") !!}
94 |
95 | |
96 |
97 | @include('laravelblocker::forms.restore-item', ['restoreType' => 'small'])
98 | |
99 |
100 | @include('laravelblocker::forms.destroy-sm')
101 | |
102 | @endif
103 |
104 | @endforeach
105 | @else
106 |
107 | {!! trans("laravelblocker::laravelblocker.blocked-table.none") !!} |
108 | |
109 | |
110 | |
111 | |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |
118 |
119 | @endif
120 |
121 | @if(config('laravelblocker.enableSearchBlocked'))
122 |
123 | @endif
124 |
125 | @if(config('laravelblocker.blockerPaginationEnabled'))
126 |
129 | @endif
130 |
131 |
--------------------------------------------------------------------------------
/src/resources/views/partials/bs-visibility-css.blade.php:
--------------------------------------------------------------------------------
1 |
210 |
--------------------------------------------------------------------------------
/src/resources/views/partials/flash-messages.blade.php:
--------------------------------------------------------------------------------
1 | @if(config('laravelblocker.blockerFlashMessagesEnabled'))
2 |
3 |
4 |
5 | @include('laravelblocker::partials.form-status')
6 |
7 |
8 |
9 | @endif
10 |
--------------------------------------------------------------------------------
/src/resources/views/partials/form-status.blade.php:
--------------------------------------------------------------------------------
1 | @if (session('message'))
2 |
11 | @endif
12 |
13 | @if (session('success'))
14 |
27 | @endif
28 |
29 | @if(session()->has('status'))
30 | @if(session()->get('status') == 'wrong')
31 |
40 | @endif
41 | @endif
42 |
43 | @if (session('error'))
44 |
57 | @endif
58 |
59 | @if (session('errors') && count($errors) > 0)
60 |
82 | @endif
83 |
--------------------------------------------------------------------------------
/src/resources/views/partials/styles.blade.php:
--------------------------------------------------------------------------------
1 |
133 |
--------------------------------------------------------------------------------
/src/resources/views/scripts/blocked-form.blade.php:
--------------------------------------------------------------------------------
1 | @if(config('laravelblocker.jQueryIpMaskEnabled'))
2 |
3 | @endif
4 |
5 |
79 |
--------------------------------------------------------------------------------
/src/resources/views/scripts/confirm-modal.blade.php:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/src/resources/views/scripts/datatables.blade.php:
--------------------------------------------------------------------------------
1 | {{-- FYI: Datatables do not support colspan or rowspan --}}
2 |
3 |
4 |
29 |
--------------------------------------------------------------------------------
/src/resources/views/scripts/search-blocked.blade.php:
--------------------------------------------------------------------------------
1 |
162 |
--------------------------------------------------------------------------------
/src/resources/views/scripts/tooltips.blade.php:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/src/routes/web.php:
--------------------------------------------------------------------------------
1 | ['web', 'checkblocked'],
11 | 'as' => 'laravelblocker::',
12 | 'namespace' => 'jeremykenedy\LaravelBlocker\App\Http\Controllers',
13 | ], function () {
14 |
15 | // Blocker
16 | Route::resource('blocker', 'LaravelBlockerController');
17 |
18 | // Blocker Soft Deleted
19 | Route::get('blocker-deleted', 'LaravelBlockerDeletedController@index')->name('blocker-deleted');
20 | Route::get('blocker-deleted/{id}', 'LaravelBlockerDeletedController@show')->name('blocker-item-show-deleted');
21 | Route::put('blocker-deleted/{id}', 'LaravelBlockerDeletedController@restoreBlockedItem')->name('blocker-item-restore');
22 | Route::post('blocker-deleted-restore-all', 'LaravelBlockerDeletedController@restoreAllBlockedItems')->name('blocker-deleted-restore-all');
23 | Route::delete('blocker-deleted/{id}', 'LaravelBlockerDeletedController@destroy')->name('blocker-item-destroy');
24 | Route::delete('blocker-deleted-destroy-all', 'LaravelBlockerDeletedController@destroyAllItems')->name('destroy-all-blocked');
25 |
26 | // Blocker Search
27 | Route::post('search-blocked', 'LaravelBlockerController@search')->name('search-blocked');
28 | Route::post('search-blocked-deleted', 'LaravelBlockerDeletedController@search')->name('search-blocked-deleted');
29 | });
30 |
--------------------------------------------------------------------------------
/tests/TestCase.php:
--------------------------------------------------------------------------------
1 |