Download the PHP package mr-timofey/laravel-admin-api without Composer
On this page you can find all versions of the php package mr-timofey/laravel-admin-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mr-timofey/laravel-admin-api
More information about mr-timofey/laravel-admin-api
Files in mr-timofey/laravel-admin-api
Package laravel-admin-api
Short Description API backend for administration panels
License MIT
Informations about the package laravel-admin-api
API backend for administration panels based on vue-admin-front package.
Demo.
Requirements
- PHP 7.1
- Laravel 5
Install
Follow installation instructions from dependent packages: mr-timofey/laravel-aio-images for images processing, mr-timofey/laravel-simple-tokens for authorization.
For Laravel <= 5.4 add MrTimofey\LaravelAdminApi\ServiceProvider
to your app.providers
config.
Look to config/admin_api.php
for further package configuration instructions.
Follow vue-admin-front quick start guide.
For development purpose you may also want to execute npm i -D concurrently
and add this script to your npm scripts:
It will run a development PHP server on port 8000 and vue-admin-front dev server on port 8080.
Authentication and authorization
This package uses mr-timofey/laravel-simple-tokens to maintain authentication and authorization logic.
You can change a guard which is used for API by setting a proper auth:{guard name}
middleware and guard name
in admin_api.api_middleware
and admin_api.api_guard
config respectively.
Remove auth
middleware if you want to disable authorization.
Also you can completely replace authentication and authorization logic by rebinding auth controller class:
app()->bind(\MrTimofey\LaravelAdminApi\Http\Controllers\Auth::class, YourController::class)
Models configuration
Admin API will try to guess attribute types and generate field names by capitalizing attribute names using model's:
$visible
to get a list of fields to display on entity index page (if not set explicitly)$fillable
to get a list of fields for editing (if not set explicitly)$hidden
fields will receive apassword
field type$dates
fields will receive adatetime
field type$casts
will just set field types as-is (don't worry,vue-admin-front
supports any Eloquent compatible types by aliasing them)- belongsTo, hasMany and belongsToMany relations will just work
You can also implement a MrTimofey\LaravelAdminApi\Contracts\ConfiguresAdminHandler
interface and define a
configureAdminHandler($handler)
method to make things more controllable.
Available field types and their options are described in vue-admin-front field types docs. Same for fields formatting for model index page vue-admin-front display types docs.
Usage example:
Events
Every action within an administrative panel can be tracked and processed with the Laravel's event system. Available events:
Tracking changes for ModelUpdated event
By default ModelUpdated
will track only instance attributes (using Eloquent's Model::getDirty()
)
method and relation changes.
You can implement MrTimofey\LaravelAdminApi\Contracts\HasCustomChanges
interface and define getCustomChanges()
method to enrich ModelUpdated::$changes
field with any additional information you want to track. Default format
is to return array ['field_name' => [$oldValue, $newValue], ...]
.
All versions of laravel-admin-api with dependencies
mr-timofey/laravel-aio-images Version 0.*
mr-timofey/laravel-simple-tokens Version 0.*
ext-json Version *