QuarkAdmin vs. DcatAdmin, laraveadmin

What is QuarkAdmin

QuarkAdmin is a tool that can help you quickly build a management background; It provides rich components that can help you build a fully functional management background with little code.

After several months of running in, quarkadmin2 0 is very mature. It's time to meet you again; Both flexibility and API simplicity are superior to other Admin extensions. Let's compare them below.

Architecture advantages

QuarkAdmin2.0 adopts the front-end and back-end separation scheme. The front-end is a low code engine based on Antd Pro. I named her quarkui; Yes, you are right. Her future orientation is a low code engine, a js framework that can assemble foreground pages through JSON configuration. The back end is a composer package compatible with various PHP frameworks (such as Thinkphp). I call it quark; Quark provides various atomic components, such as behaviors, forms, tables, menus, etc. based on Antd, there are all kinds of applications! Quark+QuarkUI=QuarkAdmin.

API simplicity

QuarkAdmin refers to Laravel Nova's solution. The API is very concise and elegant. Let's compare it with DcatAdmin:
Let's take a look at DcatAdmin and what to do to implement a page:

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new Article(), function (Grid $grid) {
            $grid->id->sortable();
            $grid->title;
            $grid->created_at;
            $grid->updated_at->sortable();

            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
            });
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new Article(), function (Show $show) {
            $show->id;
            $show->title;
            $show->created_at;
            $show->updated_at;
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new Article(), function (Form $form) {
            $form->display('id');
            $form->text('title');
            $form->display('created_at');
            $form->display('updated_at');
        });
    }

Let's take another look at QuarkAdmin:

   /**
     * Page title
     *
     * @var string
     */
    public static $title = 'article';

    /**
     * Model
     *
     * @var string
     */
    public static $model = 'App\Article';

    /**
     * field
     *
     * @param  Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [
            Field::hidden('id','ID'),
            Field::text('title'),
            Field::datetime('created_at'),
            Field::datetime('updated_at')
        ];
    }

In fact, quarkadmin1 0 also refers to laraveadmin, but in practical applications, many problems cannot be solved gracefully; One of the most troublesome problems is the bloated code. When you use laraveadmin with complex logic, you will find that a lot of code will be concentrated in grid and form methods. For example, when you have a lot of search and behavior, there will be a lot of code in grid; The author is developing quarkadmin1 0 is very painful. So in 2.0, we understand behavior and search; Stretch out the logic originally concentrated in grid and form, for example:

    /**
     * search form 
     *
     * @param  Request  $request
     * @return object
     */
    public function searches(Request $request)
    {
        return [
            new \App\Admin\Searches\Input('username', 'user name'),
        ];
    }

    /**
     * behavior
     *
     * @param  Request  $request
     * @return object
     */
    public function actions(Request $request)
    {
        return [
            new \App\Admin\Actions\FormSubmit,
            new \App\Admin\Actions\FormReset,
            new \App\Admin\Actions\FormBack,
            new \App\Admin\Actions\FormExtraBack
        ];
    }

Let's talk about the advantages of fields. In most cases, the fields of the list correspond to the fields of the form one by one, so QuarkAdmin brings together the definitions of grid and form fields, for example:

    /**
     * field
     *
     * @param  Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [
            Field::hidden('id','ID')->onlyOnForms(),
            Field::text('title','title'),
            Field::number('sort','sort'),
            Field::text('url','link'),
            Field::datetime('created_at','Add time')->onlyOnIndex(),
        ];
    }

Future vision

I now open source six libraries, namely Quark, QuarkUI, QuarkAdmin, QuarkCMS, QuarkAPP and QuarkDoc;
Quark: a Composer extension package that is compatible with all PHP frameworks and can quickly build foreground pages (completed);
QuarkUI: a low code engine that can build pages through JSON configuration (completed);
QuarkAdmin: a background extension of Laravel based on Quark and QuarkUI (completed);
QuarkCMS: a content management system based on QuarkAdmin (completed);
QuarkAPP: an engine that can build APP, various applets and H5 through JSON configuration (selection in progress)
QuarkDoc: documentation for each class library.

Write at the end

This project has lasted for two years. If the original idea is included, it has lasted for more than three years; There have been self doubt, team conflict, technical difficulties that cannot be overcome, wrong architecture direction, and various difficulties, which are really not easy. Welcome to praise. Most importantly, I hope you can use it to bring value to you.
Github:
github CMS storage: quark-cms
github backend Warehousing: quark-admin
github front end storage: quark-ui

Keywords: Laravel

Added by TheOracle on Thu, 09 Dec 2021 19:47:47 +0200