Giter Club home page Giter Club logo

laravel-admin's Introduction

laravel-admin

laravel-admin is administrative interface builder for laravel which can help you build CRUD backends just with few lines of code.

Documentation | 中文文档 | Demo | Demo source code | Extensions

Build Status StyleCI Packagist Total Downloads Awesome Laravel

Inspired by SleepingOwlAdmin and rapyd-laravel.

Sponsor

laravel-admin

Requirements

  • PHP >= 7.0.0
  • Laravel >= 5.5.0
  • Fileinfo PHP Extension

Installation

This package requires PHP 7+ and Laravel 5.5, for old versions please refer to 1.4

First, install laravel 5.5, and make sure that the database connection settings are correct.

composer require encore/laravel-admin

Then run these commands to publish assets and config:

php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"

After run command you can find config file in config/admin.php, in this file you can change the install directory,db connection or table names.

At last run following command to finish install.

php artisan admin:install

Open http://localhost/admin/ in browser,use username admin and password admin to login.

Configurations

The file config/admin.php contains an array of configurations, you can find the default configurations in there.

Right to left support

just go to this path <YOUR_PROJECT_PATH>\vendor\encore\laravel-admin\src\Traits\HasAssets.php and modify $baseCss array for loading right to left (rtl) version of bootstap and AdminLTE css files.
bootstrap.min.css change it to bootstrap.rtl.min.css
AdminLTE.min.css change it to AdminLTE.rtl.min.css

Extensions

Extension Description laravel-admin
helpers Several tools to help you in development ~1.5
media-manager Provides a web interface to manage local files ~1.5
api-tester Help you to test the local laravel APIs ~1.5
scheduling Scheduling task manager for laravel-admin ~1.5
redis-manager Redis manager for laravel-admin ~1.5
backup An admin interface for managing backups ~1.5
log-viewer Log viewer for laravel ~1.5
config Config manager for laravel-admin ~1.5
reporter Provides a developer-friendly web interface to view the exception ~1.5
wangEditor A rich text editor based on wangeditor ~1.6
summernote A rich text editor based on summernote ~1.6
china-distpicker 一个基于distpicker的**省市区选择器 ~1.6
simplemde A markdown editor based on simplemde ~1.6
phpinfo Integrate the phpinfo page into laravel-admin ~1.6
php-editor
python-editor
js-editor
css-editor
clike-editor
Several programing language editor extensions based on code-mirror ~1.6
star-rating Star Rating extension for laravel-admin ~1.6
json-editor JSON Editor for Laravel-admin ~1.6
grid-lightbox Turn your grid into a lightbox & gallery ~1.6
daterangepicker Integrates daterangepicker into laravel-admin ~1.6
material-ui Material-UI extension for laravel-admin ~1.6
sparkline Integrates jQuery sparkline into laravel-admin ~1.6
chartjs Use Chartjs in laravel-admin ~1.6
echarts Use Echarts in laravel-admin ~1.6
simditor Integrates simditor full-rich editor into laravel-admin ~1.6
cropper A simple jQuery image cropping plugin. ~1.6
composer-viewer A web interface of composer packages in laravel. ~1.6
data-table Advanced table widget for laravel-admin ~1.6
watermark Text watermark for laravel-admin ~1.6
google-authenticator Google authenticator ~1.6

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Other

laravel-admin based on following plugins or services:

License

laravel-admin is licensed under The MIT License (MIT).

laravel-admin's People

Contributors

a443939412 avatar antranapp avatar artem-tverdokhlebov avatar axyr avatar drop0118 avatar dynamohuang avatar feistiny avatar hanson avatar hirossyi-exc avatar jonphipps avatar joy2fun avatar jxlwqq avatar langeuh avatar luischavez avatar mhanoglu avatar mhenselin avatar never615 avatar p2p-sys avatar rust17 avatar spinyman avatar sswm1975 avatar sy-dante avatar taha-moghaddam avatar terranc avatar uacode avatar xiaohuilam avatar z-song avatar zanemmm avatar zishang520 avatar zsgsdesign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-admin's Issues

Middleware to protect page

I've been using Menu to utilize access control for user that has a role. It works smoothly that entry menu didn't show up if user didn't have a role.

Like if user is not administrator, they can't see Users page appear on sidebar. But they still be able to open Users page by manually type http://localhost:8000/admin/auth/users.

How to protect routes like adding 401 unauthorized into laravel-admin?

menu错误

image
没有发现有menu的文件?我的是1.3版本。

not all examples in readme do not work

$form->display('updated_at'); does not show anything

and

$form->divider(); seems to not to do anything?

$grid->title(); is a bit misleading when you have a column title in your table...
But $grid->title(); is the Title of the Grid. not the column title

多文件或多图片

现在的File和Image模块好像只能处理一对一关系. 也就是说我的一篇文章只能附加一个文件或者一张图片.
但多数时候我会想要附加不止一个, 请问有什么思路可以解决这样的问题吗? 谢谢.

GRID FORM 使用文档

有没有 GRID FORM 的使用文档之类的!用着好吃力!
还有 默认 edit creat 方法 提交 是提交到哪里

安装中出现的问题

你好,在根据readme的安装步骤中有以下问题:

安装
问题1:git clone 的master版本找不到config/app.php这个文件
在config/app.php加入ServiceProvider:

Encore\Admin\Providers\AdminServiceProvider::class
然后运行下面的命令完成安装:

问题2:在根目录执行php artisan,提示Could not open input file: artisan
php artisan vendor:publish --tag=laravel-admin
php artisan admin:install

另外,请问你有及时联系的方式么,比如QQ或者微信,遇到问题也可以及时请教

select filters not working when the option value is 0.

when you try to filter the grid with something like this my_filter=0&my_other_filter=2
then the filters that are = 0 are not considered.
This is a bug when working with mysql boolean fields (0,1) - you can only filter for 1, not for 0

Any interest in coding against an interface?

So we don't have to extend formfields, but just implement the interface...

<?php
namespace Encore\Admin\Contracts;

use Encore\Admin\Form;

interface Field
{
    /**
     * Fill data to the field.
     *
     * @param $data
     * @return void
     */
    public function fill($data);

    /**
     * Set original value to the field.
     *
     * @param $data
     * @return void
     */
    public function setOriginal($data);

    /**
     * Set the Form to the field
     *
     * @param Form $form
     * @return \Encore\Admin\Form\Field
     */
    public function setForm(Form $form);

    /**
     * Set the field options.
     *
     * @param array $options
     * @return \Encore\Admin\Form\Field
     */
    public function options($options = []);

    /**
     * Get or set rules.
     *
     * @param null $rules
     * @return string
     */
    public function rules($rules = null);

    /**
     * Set or get value of the field.
     *
     * @param null $value
     * @return mixed
     */
    public function value($value = null);

    /**
     * Get column of the field.
     *
     * @return string
     */
    public function column();

    /**
     * Get label of the field.
     *
     * @return string
     */
    public function label();

    /**
     * Get original value of the field.
     *
     * @return mixed
     */
    public function original();

    /**
     * Set the field as readonly mode.
     */
    public function readOnly();

    /**
     * Get view of this field.
     *
     * @return string
     */
    public function getView();

    /**
     * Render this filed.
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function render();
}

更新版本问题注意事项

如果更新之后提示报错:表admin_operation_log不存在,是因为添加了操作日志功能,新增了表和配置,解决办法如下:

1.在相应数据库里面新建表

CREATE TABLE `admin_operation_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `method` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `ip` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
  `input` text COLLATE utf8_unicode_ci,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `admin_operation_log_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

2.在config/admin.php添加配置
在database下添加一条 'operation_log_table' => 'admin_operation_log',

3.打开http://localhost:8000/admin/auth/menu添加一项菜单,父级菜单选择Auth,URI填admin/auth/logs,Title填操作日志, Icon填fa-history

然后就能在菜单栏看到操作日志入口了

Between and DateTime filters

fix JS
now you use

protected $js = [
    **'moment/min/moment.min.js',**
    'eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js'
];

change to

protected $js = [
    'moment/min/moment-with-locales.min.js',
    'eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js'
];

and remove
$js[] = "moment/locale/{$options['locale']}.js";

Your requirements could not be resolved to an installable set of packages

Your requirements could not be resolved to an installable set of packages.

Problem 1
- intervention/image 2.3.8 requires ext-fileinfo * -> the requested PHP exte nsion fileinfo is missing from your system.
- intervention/image 2.3.7 requires ext-fileinfo * -> the requested PHP exte nsion fileinfo is missing from your system.
- intervention/image 2.3.6 requires ext-fileinfo * -> the requested PHP exte nsion fileinfo is missing from your system.
- intervention/image 2.3.5 requires ext-fileinfo * -> the requested PHP exte nsion fileinfo is missing from your system.
- intervention/image 2.3.4 requires ext-fileinfo * -> the requested PHP exte nsion fileinfo is missing from your system.
- intervention/image 2.3.3 requires ext-fileinfo * -> the requested PHP exte nsion fileinfo is missing from your system.
- intervention/image 2.3.2 requires ext-fileinfo * -> the requested PHP exte nsion fileinfo is missing from your system.
- intervention/image 2.3.1 requires ext-fileinfo * -> the requested PHP exte nsion fileinfo is missing from your system.
- intervention/image 2.3.0 requires ext-fileinfo * -> the requested PHP exte nsion fileinfo is missing from your system.
- encore/laravel-admin dev-master requires intervention/image ~2.3 -> satisf iable by intervention/image[2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3 .7, 2.3.8].
- Installation request for encore/laravel-admin dev-master -> satisfiable by encore/laravel-admin[dev-master].

To enable extensions, verify that they are enabled in those .ini files:
- D:\AppServ\php5\php.ini
You can also run php --ini inside terminal to see which files are used by PH P in CLI mode.

请教关于权限控制的用法

文档有提到可以在控制器类内进行权限控制,这样做的有一个小问题,后台菜单对所有用户都默认显示了,点击进去后才会执行权限控制代码。如果需要管理用户登录后立即判断管理权限并显示有权限的菜单选项,应该需要如何操作?

安装错误

image

安装后出现这个错误,不知道是那里出了问题

可以自己命名路由吗

$router->post('comments/block/{$id}', 'CommentController@block')->name('admin.comments.block');

这样会报错:
image

form 多选控件 错误

$form->multipleSelect($column[, $label])->options([1 => 'foo', 2 => 'bar', 'val' => 'Option name']);
多选框使用错误,貌似是数据格式不识别;

再有一点,麻烦 添加一些 ajax 调用 和 类似于省份市之类的多选!

登录记住我功能不起效果

image
勾选remeber me字段,但是session失效后(120分钟),没用自动登录。

image
看登录逻辑中没有对remember字段的处理。
请问这个是功能还没有实现还是我哪里没有配置好?

column()方法似乎不能正常工作

我用的5.2版本的laravel。因为我表里面有个column叫title和一个方法重名,所以要按照文档里面:

使用column()方法:$grid->column('name', '用户名');

但是我使用的时候提示

ErrorException in Grid.php line 131:
Undefined variable: relation

Your requirements could not be resolved to an installable set of packages.

安装报错:
[root@iZ23m2zt6hsZ laravel-admin]# composer require encore/laravel-admin "dev-master"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package encore/laravel-admin No version set (parsed as 1.0.0) is satisfiable by encore/laravel-admin[No version set (parsed as 1.0.0)] but these conflict with your requirements or minimum-stability.

Installation failed, reverting ./composer.json to its original content.

tests.....

From all of the packages that promise an easy way of creating cruds and admins, I really thing this one has the best approach.

Im working a lot with the Silverstripe Framework and there Forms works more or less the same.

I guess this package can gain a lot of ground with some tests.

升级后出错!!

Updating encore/laravel-admin 1.3.x-dev (aa5ecfa => a2a5f6d)

php 5.6.16
laravel 5.3.15
qq 20160930173256

路径: http://localhost/admin/auth/users/create

Oops! Something went wrong.

In 4b652399b4089f7b955876f81f16ce9006e97948.php line 12 : Undefined variable: options (View: C:\wamp64\www\laravelapp\laravel\vendor\encore\laravel-admin\views\form\multipleselect.blade.php) (View: C:\wamp64\www\laravelapp\laravel\vendor\encore\laravel-admin\views\form\multipleselect.blade.php)

grid使用

您好,想请问我这么调用grid有什么问题吗,为什么一直报错

public function index(){
    return Admin::content(function(Content $content){
      $content->header('app用户');
      $content->description('用户信息');
      $content->body($this->grid()->render());
    });
  }

  protected function grid(){
    return Admin::grid(AppUserModel::class,function(Grid $grid){
      $grid->id('id');
      $grid->name();
      $grid->created_at()->sortable();
      $grid->updated_at();
    });
  }

一直提示我 Undefined index: xx (View: F:\Apache24\htdocs\yulejia\vendor\encore\laravel-admin\views\grid.blade.php),
想问一下是我那里写错了吗

Possible to use custom Form Fields?

I have a custom file storage system and File class.

Therefore I would like to add my own File field so I can write the file in my own way.

But this prevents using custom forms:

$className = __NAMESPACE__ . '\\Form\\Field\\' . ucfirst($method);

Am I missing something?

Composer problem

Run composer require encore/laravel-admin "1.3.x-dev" for Laravel 5.3, got this line:

Failed to download encore/laravel-admin from source: Failed to clone https://github.com/z-song/laravel-admin.git, git was not found, check that it is installed and in your PATH env.

'git' is not recognized as an internal or external command,
operable program or batch file.

Allow extending Form Class and add extra FormActions

So we can add buttons like save & close, save, delete, copy, send new password, etc.
or add some buttons that just contain a link to for example a ChangePassword Form to seperate update actions.

Here is some pseudo/sample code how I see this, heavily borrowing from Silverstripe.

class MyForm extends Encore\Admin\Form
{
    $template = 'something_custom_with_a_default';

    public function addFormAction(FormAction $action)
    {
        $action->setForm($this);
        $this->formactions->push($action); // could have some defaults??
        return $this;
    }
}

class MyFormAction extends FormAction
{
    $template = 'something_custom_with_a_default';

    //$rules = []; somecustomrules here? or create a Request class with rules?;

    // Form would always call the FormAction->submit(); method...
    public function submit($data, Form $form, Request $request)
    {
        // do something with submitted $data or $form->model()

        // do some other custom things

        // trigger an event

        // set a flash message

        // return redirect response or let the Form class do something by default.
    }
}

I think with this approach, instead of keeping the update/create logic in the form, it should be moved to a dedicated SaveFormAction and / or UpdateFormAction. Which also allows custom validation when creating or updating a model.

Updating or Saving could also be decided by checking the $model->getKey(); value?

If you like this idea, im happy to dive into it....

Password example does not work

On subsequent save the password gets bcrypted again with this example :

 $form->saving(function($form) {
        $form->password = bcrypt($form->password);
    });

I think there are several ways to solve this, but this depends where you want to go with this:

  • keep all logic in the model and use a mutator in Administrator:
public function setPasswordAttribute($password)
    {
        if($password && $password != $this->password) {
            $this->attributes['password'] = bcrypt($password);
        }
    }
  • move the logic to the password field.

there is already a prepare method that returns the changed value, but we need access to the Form object in the FormFields. This can be handy for other formfields as well :

public function pushField(Field $field)
    {
        $field->setForm($this);

        $this->builder->fields()->push($field);

        return $this;
    }

Give Fields access to the Form and the Model

I will come up with better PR's soon, but I need a crashcourse for that first.

I have some extended form fields, where I want to do more with a Model then only write a value to the column. like setting other values based upon the submission, and this needs to be done before a value is set on a model.

There is a lot of flexiblilty if we could have access to the Form and Model in the Form Fields and can be done pretty easy to add this to the forms:

  • Make model public :
    /**
     * @return Model
     */
    public function model()
    {
        return $this->model;
    }
  • pass the Form object to the form fields :
    /**
     * @param Field $field
     *
     * @return $this
     */
    public function pushField(Field $field)
    {
        $field->setForm($this);

        $this->builder->fields()->push($field);

        return $this;
    }

and change the line in __call()

$this->builder->fields()->push($element);

to this :

$this->pushField($element);

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.