artcoder / ladmin
ladmin is a laravel package admin management panel
Installs: 22
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- barryvdh/laravel-ide-helper: ^2.12
- doctrine/dbal: ^3.7
- nwidart/laravel-modules: ^8.3
- ottaviano/faker-gravatar: ^0.2.0
- phpoffice/phpspreadsheet: ^1.26
- spatie/laravel-html: ^2.30
- spatie/laravel-permission: ^5.7
This package is auto-updated.
Last update: 2025-03-24 12:49:13 UTC
README
# composer 镜像 https://pkg.xyz/ composer create-project laravel/laravel=8.* test composer create-project laravel/laravel demo cd demo composer require artcoder/ladmin
// composer.json { "autoload": { "psr-4": { // ... "Modules\\": "Modules/" } } }
mkdir Modules composer dump-autoload
// config/auth.php 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => Artcoder\Ladmin\Entities\User::class, ], ],
// app/Http/Middleware/EncryptCookies.php protected $except = [ 'hints' ];
// config/app.php 'providers' => [ // ... Artcoder\Ladmin\AdminServiceProvider::class, ],
# .env
DB_DATABASE=xxx
DB_USERNAME=xxx
DB_PASSWORD=xxx
php artisan ladmin:setup ... #for update #del admin.php & status.php #php artisan vendor:publish --provider="Artcoder\Ladmin\AdminServiceProvider"
Modules & Repository
php artisan module:make Cms
// CmsController.php // ... use use Artcoder\Ladmin\Http\Controllers\Controller as AdminController; // ... class CmsController extends AdminController { // ... public $moduleName = 'cms'; // ... // Model use Artcoder\Ladmin\Entities\Model; class FarmingAccount extends Model // Repositories namespace Modules\Cms\Repositories; use Modules\Cms\Entities\Posts; use Artcoder\Ladmin\Repositories\BaseRepository; // or use Artcoder\Ladmin\Repositories\AdminRepository; class PostsRepository extends BaseRepository { // ... // ->model('category', 'cms') // model // ->repository('category', 'cms') // repository } // view $folder = 'cms-posts'; $title = '文章列表'; $targetUrl = route('admin.cms.create'); $targetTitle = '添加文章'; $list = $this->posts->all(); return view( 'cms::' . $folder . '.index', compact('folder', 'list', 'title', 'targetUrl', 'targetTitle') ); return view( 'admin::partials.create', compact('folder', 'title', 'targetUrl', 'targetTitle', 'model', 'formUrl') ); return view( 'admin::partials.edit', compact('id', 'folder', 'title', 'targetUrl', 'targetTitle', 'model', 'formUrl') );
// Traits // Artcoder\Ladmin\Libraries\Support\Traits\HasConfig // #cacheKey // @getItem($index, $defalt = false) // @clearCache() // @getList() // Artcoder\Ladmin\Libraries\Support\Traits\HasConfigRepository // @info($index = '') // @pluckInfo() // @clearCache() // Artcoder\Ladmin\Libraries\Support\Traits\HasStatus // # // Artcoder\Ladmin\Libraries\Support\Traits\HasStoreAuth // Artcoder\Ladmin\Libraries\Support\Traits\HasTree // Artcoder\Ladmin\Libraries\Support\Traits\HasTreeRepository // Artcoder\Ladmin\Libraries\Support\Traits\HasUnableDeletePK // #unableIdValue [1, 2...] // @canDeletePK()