prageeth-peiris / site-allocator
A Laravel Package to Allocate Sites to a User
1.0.0
2022-04-05 18:43 UTC
Requires
- php: ^8.0
- illuminate/support: ^9.0
- spatie/laravel-data: ^1.4
Requires (Dev)
- orchestra/testbench: ^7.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-03-13 18:00:26 UTC
README
A Simple Laravel Package to Allow / Disallow a site to a user. This is useful for projects that uses Site as a main model.
Requirements
- PHP >= 8.0
- Laravel >= 9.0
Installation
You can install the package via composer:
composer require prageeth-peiris/site-allocator
Publish Configuration File
php artisan vendor:publish --provider="PrageethPeiris\SiteAllocator\SiteAllocatorServiceProvider" --tag="config"
Run migrations
php artisan migrate
Usage
Add ownSite trait to your User model
class User { use ownSite; }
use "is-site-allocated" middleware in your routes. Should pass the site_id as a query parameter with request
Documentation
API Routes
- GET /api/sites
- GET /api/sites/id
- POST /api/sites {name - string parameter , url string parameter}
- PUT /api/sites {name - string parameter , url string parameter}
- DELETE /api/sites/id
- GET /api/user/id/sites
- POST /api/user/id/sites {sites - array parameter}
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email glpspeiris@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.