Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kristories/laravel-rsd
Subdomain validator for Laravel
https://github.com/kristories/laravel-rsd
laravel laravel-framework subdomain subdomains validator
Last synced: 4 months ago
JSON representation
Subdomain validator for Laravel
- Host: GitHub
- URL: https://github.com/kristories/laravel-rsd
- Owner: Kristories
- License: mit
- Archived: true
- Created: 2018-04-26T01:21:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-04-26T01:44:57.000Z (over 6 years ago)
- Last Synced: 2024-09-25T21:02:14.972Z (4 months ago)
- Topics: laravel, laravel-framework, subdomain, subdomains, validator
- Language: PHP
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Reserved Subdomains
[![Latest Version on Packagist](https://img.shields.io/packagist/v/Kristories/laravel-rsd.svg?style=flat-square)](https://packagist.org/packages/Kristories/laravel-rsd)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/Kristories/laravel-rsd/master.svg?style=flat-square)](https://travis-ci.org/Kristories/laravel-rsd)Subdomain validator for Laravel.
## Requirements
This package requires Laravel 5.5 or higher.
## Installation
You can install this package via composer using this command :
```
composer require kristories/laravel-rsd
```The package will automatically register itself.
Publish the configuration file :
```
php artisan vendor:publish --tag=config
```## Usage
```php
// Route
Route::group(['domain' => '{account}.domain.tld'], function () {
Route::middleware(['rsd'])->group(function () {
Route::get('/', function () {
return view('welcome');
});
});
});// Kernel
protected $routeMiddleware = [
'rsd' => \Kristories\Rsd\Rsd::class,
];
```Or
```php
// Route
Route::group(['domain' => '{account}.domain.tld'], function () {
Route::get('/', function () {
return view('welcome');
});
});// Kernel
rotected $middleware = [
\Kristories\Rsd\Rsd::class,
];
```### Driver
#### Array
##### ENV
```
RSD_DRIVER=array
```##### Config
```php
'subdomains' => [
'dev',
'staging',
'private',
'reserved',
'status',
],
```#### Database
##### ENV
```
RSD_DRIVER=database
```##### Config
```php
'model' => App\YourModel::class
```##### Model
```php
use Kristories\Rsd\ReservableTrait;
use Illuminate\Database\Eloquent\Model;class YourModel extends Model
{
use ReservableTrait;protected $reserved_column = 'name';
}
```##### Extra scope
```php
use Kristories\Rsd\ReservableTrait;
use Illuminate\Database\Eloquent\Model;class YourModel extends Model
{
use ReservableTrait;protected $reserved_column = 'name';
public function scopeReservedExtra($query)
{
return $query->where('active', true);
}
}
```## Contributing
Please see [CONTRIBUTING](https://github.com/kristories/laravel-rsd/blob/master/CONTRIBUTING.md) for details.
## License
The MIT License (MIT). Please see [License File](https://github.com/kristories/laravel-rsd/blob/master/LICENSE.md) for more information.