devs_ryan / laravel-easy-api
Converts Laravel Easy Admin into a headless CMS.
Requires
- php: >=7.2
- devs_ryan/laravel-easy-admin: >=0.1.x-dev
- intervention/image: ^2.5
- laravel/framework: >=7.0
This package is auto-updated.
Last update: 2024-10-11 01:53:50 UTC
README
~ A simple admin panel for Laravel projects.
What is Laravel Easy Api
Laravel Easy Api is a back end UI designed for developers, root users with decent database knowledge or basic projects. It is not meant to serve as a complete Admin panel with full capabilities (see Lavavel Nova if this is what you are looking for). On the contrary it is mean to act as a basic admin panel, with limited customizability, that can get up and running within minutes.
Laravel Easy Api leverages a powerful set of artisan commands to add/remove resources. This is combined with public files where functionality can be removed or added via commenting/uncommenting code which allows Easy Api to give basic ability for customization. If you need a quick and dirty admin panel for your project, this package is for you! :)
Installation
composer require devs_ryan/laravel-easy-api
- Access from http(s)://your-project-url.com/easy-api
Usage
Setting env variables
The following optional URL variables can be set in the Laravel .env file:
API_TOKEN
(will be sent with all requests to verify authentication Eg.response = $axios.get('http://my-app-url/easy-api/index?api_token='.token')
)EASY_ADMIN_BASE_URL
(Change the base URL for your API. Default is `easy-api)
Generate a random API_TOKEN
- TODO
Add a model resource to Easy Api
After running this command a CRUD resource will be added to the Easy Api UI for the model specified.
php artisan easy-api:add-model
- Follow the prompts for namespace E.G. "App" and model name E.G. "User"
- This will generate a new file in the base projects app/EasyApi directory, where you can comment out any functionality you do not wish to provide to the Easy Api UI
Remove a model resource from Easy Api
php artisan easy-api:remove-model
- Follow the prompts for namespace E.G. "App" and model name E.G. "User"
- This will remove the model from showing in the UI and delete the app/EasyApi file for it as well
Refresh a model resource in Easy Api
php artisan easy-api:refresh-model
- Follow the prompts for namespace E.G. "App" and model name E.G. "User"
- This will reload the public file in the app/EasyApi directory to the default and load/remove any fields that have changed in the model
Add all model resources to Easy Api
This is not currently working, but on my TODO list.
Reset Easy Api
In case you would like to return Easy Api to the original state, use the command below.
php artisan easy-api:reset
Limitations
This admin panel assumes that you follow the standard Laravel naming conventions for models and database tables. If you create migrations/models using php artisan make:model {ModelName} -m
it should work, otherwise it may not.
The users table is expected to contain some fields that ship with the Laravel base install, such as email
and password
.
All model resources must contain and id
attribute in their database table for the routing to function.
Licence
Laravel Easy Api is open-sourced software licensed under the MIT license.