Skip to content
Subdomain validator for Laravel
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
src
tests
.editorconfig
.gitignore
.travis.yml
CONTRIBUTING.md
LICENSE.md
README.md
composer.json
phpunit.xml

README.md

Laravel Reserved Subdomains

Latest Version on Packagist Software License Build Status

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

// 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

// 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
'subdomains' => [
    'dev',
    'staging',
    'private',
    'reserved',
    'status',
],

Database

ENV
RSD_DRIVER=database
Config
'model' => App\YourModel::class
Model
use Kristories\Rsd\ReservableTrait;
use Illuminate\Database\Eloquent\Model;

class YourModel extends Model
{
    use ReservableTrait;

    protected $reserved_column = 'name';
}
Extra scope
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 for details.

License

The MIT License (MIT). Please see License File for more information.

You can’t perform that action at this time.