the42coders / the-laravel-admin-panel
A package to create an Admin panel with basic crud.
Installs: 41
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 1
Forks: 2
Open Issues: 1
Language:JavaScript
Requires
- php: >7.1
- illuminate/support: ^9.0
- spatie/laravel-medialibrary: ^9.0.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpstan/phpstan: ^1.2
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-11-09 16:53:27 UTC
README
Installation
You can install the package via composer:
composer require the42coders/the-laravel-admin-panel
You need to register the routes to your web.php routes File as well. Since the-laravel-admin-panel Package is very powerful make sure to secure the routes with whatever authentication you use in the rest of your app.
Route::group(['middleware' => ['auth']], function () { \the42coders\TLAP\TLAP::routes(); });
You need to publish the assets of the Package
php artisan vendor:publish --provider="the42coders\TLAP\TLAPServiceProvider" --tag=assets
Other publishable Contents are
config
php artisan vendor:publish --provider="the42coders\TLAP\TLAPServiceProvider" --tag=config
language
php artisan vendor:publish --provider="the42coders\TLAP\TLAPServiceProvider" --tag=lang
views
php artisan vendor:publish --provider="the42coders\TLAP\TLAPServiceProvider" --tag=views
Usage
To generate the CRUD for a Model just add the TLAPAdminTrait to your Model.
use the42coders\TLAP\Traits\TLAPAdminTrait; class User extends Model { use TLAPAdminTrait;
and register it in the config tlap.php.
'models' => [ 'users' => 'App\Models\User', ]
Now you can just visit the url of https://your-website.de/admin. You can change the url under which the admin panel will be accessible in the tlap.php config file with the path variable.
This package autoload your relations if you use return types on them.
public function posts(): HasMany { return $this->hasMany('App\Models\Post'); }
The package is guessing your application by its Database structure. Including validation. But you can overwrite this guessing by your own wishes.
You only need to add the static function fields to your Model and set the $fields array with your Field definitions. This is the area which might change a little before the final release.
public static function fields() { self::$fields = [ new TextField('name', 'Name'), new TextField('slug', 'Slug'), new TextField('description', 'Description', false), new TextField('menu', 'Menu'), new TextField('image', 'Image'), new TextField('parent_id', 'Parent ID'), ]; return self::$fields; }
By now we have the following Fields out of the box.
In the future it will be possible to add your own Fields as well.
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 max@42coders.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.