Coder Social home page Coder Social logo

ladmin's Introduction

Installation

# 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()

ladmin's People

Contributors

art-coder avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.