prageeth-peiris/site-allocator

A Laravel Package to Allocate Sites to a User

1.0.0 2022-04-05 18:43 UTC

This package is auto-updated.

Last update: 2024-04-13 15:56:20 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.