安装
1.安装Laravel
composer global require laravel/installer
laravel new blog
2.安装Laravel-admin
首先确保安装好了laravel,并且数据库连接设置正确。
composer require encore/laravel-admin
然后运行下面的命令来发布资源:
php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
在该命令会生成配置文件config/admin.php,可以在里面修改安装的地址、数据库连接、以及表名,建议都是用默认配置不修改。
然后运行下面的命令完成安装:
php artisan admin:install
启动服务后,在浏览器打开 http://localhost/admin/ ,使用用户名 admin 和密码 admin登录.
3.安装Editor.md
安装laravel-admin-ext-editormd,该扩展集成了editor.md,很适合作为后台web编辑器
composer require sharemant/laravel-admin-ext-editormd
php artisan vendor:publish --tag=laravel-admin-ext-editormd
在 config/admin.php 的 extensions 数组中添加配置:
'extensions' => [
'editormd' => [
// Set to false if you want to disable this extension
'enable' => true,
// Set to true if you want to take advantage the screen length for your editormd instance.
'wideMode' => false,
// Set to true when the instance included in larave-admin tab component.
'dynamicMode' => false,
// Editor.js configuration (Refer to http://pandao.github.io/editor.md/)
'config' =>
[
'path' => '/vendor/laravel-admin-ext/editormd/editormd-1.5.0/lib/',
'width' => '100%',
'height' => 600,
'emoji' => true
]
]
]
后台form组件调用:
$form->editormd('markdown');