配置

安装完成之后,会生成两个配置文件,用来对管理后台进行配置,config/admin.phpapp/Admin/bootstrap.php

config/admin.php

  1. <?php
  2. return [
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Laravel-admin name
  6. |--------------------------------------------------------------------------
  7. |
  8. | 登录页面的大标题,显示在登录页面
  9. |
  10. */
  11. 'name' => 'Laravel-admin',
  12. /*
  13. |--------------------------------------------------------------------------
  14. | Laravel-admin logo
  15. |--------------------------------------------------------------------------
  16. |
  17. | 管理页面的logo设置,如果要设置为图片,可以设置为img标签
  18. | <img src="http://logo-url" alt="Admin logo">'.
  19. |
  20. */
  21. 'logo' => '<b>Laravel</b> admin',
  22. /*
  23. |--------------------------------------------------------------------------
  24. | Laravel-admin mini logo
  25. |--------------------------------------------------------------------------
  26. |
  27. | 当左侧边栏收起时显示的小logo,也可以设置为html标签
  28. |
  29. */
  30. 'logo-mini' => '<b>La</b>',
  31. /*
  32. |--------------------------------------------------------------------------
  33. | Laravel-admin bootstrap setting
  34. |--------------------------------------------------------------------------
  35. |
  36. | 用来设置启动文件
  37. |
  38. */
  39. 'bootstrap' => app_path('Admin/bootstrap.php'),
  40. /*
  41. |--------------------------------------------------------------------------
  42. | Laravel-admin route settings
  43. |--------------------------------------------------------------------------
  44. |
  45. | 后台路由配置,应用在`app/Admin/routes.php`里面
  46. |
  47. */
  48. 'route' => [
  49. 'prefix' => 'admin',
  50. 'namespace' => 'App\\Admin\\Controllers',
  51. 'middleware' => ['web', 'admin'],
  52. ],
  53. /*
  54. |--------------------------------------------------------------------------
  55. | Laravel-admin install directory
  56. |--------------------------------------------------------------------------
  57. |
  58. | 后台的安装目录,如果在运行`admin:install`之前修改它,那么后台目录将会是这个配置的目录
  59. |
  60. */
  61. 'directory' => app_path('Admin'),
  62. /*
  63. |--------------------------------------------------------------------------
  64. | Laravel-admin html title
  65. |--------------------------------------------------------------------------
  66. |
  67. | 所有页面的<title>标签内容
  68. |
  69. */
  70. 'title' => 'Admin',
  71. /*
  72. |--------------------------------------------------------------------------
  73. | Access via `https`
  74. |--------------------------------------------------------------------------
  75. |
  76. | 后台是否使用https
  77. |
  78. */
  79. 'https' => env('ADMIN_HTTPS', false),
  80. /*
  81. |--------------------------------------------------------------------------
  82. | Laravel-admin auth setting
  83. |--------------------------------------------------------------------------
  84. |
  85. | 后台用户使用的用户认证配置
  86. |
  87. */
  88. 'auth' => [
  89. 'controller' => App\Admin\Controllers\AuthController::class,
  90. 'guards' => [
  91. 'admin' => [
  92. 'driver' => 'session',
  93. 'provider' => 'admin',
  94. ],
  95. ],
  96. 'providers' => [
  97. 'admin' => [
  98. 'driver' => 'eloquent',
  99. 'model' => Encore\Admin\Auth\Database\Administrator::class,
  100. ],
  101. ],
  102. // Add "remember me" to login form
  103. 'remember' => true,
  104. // 登陆之后的跳转地址
  105. 'redirect_to' => 'auth/login',
  106. // 登陆验证的排除URI
  107. 'excepts' => [
  108. 'auth/login',
  109. 'auth/logout',
  110. ],
  111. ],
  112. /*
  113. |--------------------------------------------------------------------------
  114. | Laravel-admin upload setting
  115. |--------------------------------------------------------------------------
  116. |
  117. | 在Form表单中的image和file类型的默认上传磁盘和目录设置,其中disk的配置会使用在
  118. | config/filesystem.php里面配置的一项disk
  119. |
  120. */
  121. 'upload' => [
  122. // `config/filesystem.php`中设置的disk
  123. 'disk' => 'admin',
  124. // image和file类型表单元素的上传目录
  125. 'directory' => [
  126. 'image' => 'images',
  127. 'file' => 'files',
  128. ],
  129. ],
  130. /*
  131. |--------------------------------------------------------------------------
  132. | Laravel-admin database settings
  133. |--------------------------------------------------------------------------
  134. |
  135. | 安装laravel-admin之后,默认会在数据库中新建下面9张表,包括用户、菜单、角色、权限、
  136. | 日志和它们之间的关系表,下面的配置是标的名字和对应的模型
  137. |
  138. | 其中的`connection`配置为下面几个模型所使用的数据库连接,对应`config/database.php`
  139. | 中的connections里面设置的connection,
  140. |
  141. | 如果你想修改数据库里面这几个表的名字,可以在运行`admin:install`之前修改它们
  142. | 如果install之后想修改,那么可以手动在数据库中修改,然后再修改下面几项的值
  143. |
  144. | 如果你需要在表里面增加字段,可以自定义模型,然后替换掉下面的模型设置即可,控制器的修改
  145. | 也可以通过覆盖路由的方式、覆盖掉内置的路由配置
  146. |
  147. */
  148. 'database' => [
  149. // Database connection for following tables.
  150. 'connection' => '',
  151. // User tables and model.
  152. 'users_table' => 'admin_users',
  153. 'users_model' => Encore\Admin\Auth\Database\Administrator::class,
  154. // Role table and model.
  155. 'roles_table' => 'admin_roles',
  156. 'roles_model' => Encore\Admin\Auth\Database\Role::class,
  157. // Permission table and model.
  158. 'permissions_table' => 'admin_permissions',
  159. 'permissions_model' => Encore\Admin\Auth\Database\Permission::class,
  160. // Menu table and model.
  161. 'menu_table' => 'admin_menu',
  162. 'menu_model' => Encore\Admin\Auth\Database\Menu::class,
  163. // Pivot table for table above.
  164. 'operation_log_table' => 'admin_operation_log',
  165. 'user_permissions_table' => 'admin_user_permissions',
  166. 'role_users_table' => 'admin_role_users',
  167. 'role_permissions_table' => 'admin_role_permissions',
  168. 'role_menu_table' => 'admin_role_menu',
  169. ],
  170. /*
  171. |--------------------------------------------------------------------------
  172. | User operation log setting
  173. |--------------------------------------------------------------------------
  174. |
  175. | 操作日志记录的配置
  176. |
  177. */
  178. 'operation_log' => [
  179. // 是否开启日志记录、默认打开
  180. 'enable' => true,
  181. /*
  182. * 允许记录请求日志的HTTP方法
  183. */
  184. 'allowed_methods' => ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
  185. /*
  186. * 不需要被记录日志的url路径
  187. */
  188. 'except' => [
  189. 'admin/auth/logs*',
  190. ],
  191. ],
  192. /*
  193. |--------------------------------------------------------------------------
  194. | User default avatar
  195. |--------------------------------------------------------------------------
  196. |
  197. | 默认头像
  198. |
  199. */
  200. 'default_avatar' => '/vendor/laravel-admin/AdminLTE/dist/img/user2-160x160.jpg',
  201. /*
  202. |--------------------------------------------------------------------------
  203. | Admin map field provider
  204. |--------------------------------------------------------------------------
  205. |
  206. | model-form中map组件所使用的地图配置,支持三个地图服务商: "tencent", "google", "yandex".
  207. |
  208. */
  209. 'map_provider' => 'google',
  210. /*
  211. |--------------------------------------------------------------------------
  212. | Application Skin
  213. |--------------------------------------------------------------------------
  214. |
  215. | 皮肤设置,参考https://adminlte.io/docs/2.4/layout设置
  216. |
  217. | 支持的设置为:
  218. | "skin-blue", "skin-blue-light", "skin-yellow", "skin-yellow-light",
  219. | "skin-green", "skin-green-light", "skin-purple", "skin-purple-light",
  220. | "skin-red", "skin-red-light", "skin-black", "skin-black-light".
  221. |
  222. */
  223. 'skin' => 'skin-blue-light',
  224. /*
  225. |--------------------------------------------------------------------------
  226. | Application layout
  227. |--------------------------------------------------------------------------
  228. |
  229. | 布局设置,参考https://adminlte.io/docs/2.4/layout
  230. |
  231. | 支持的设置为: "fixed", "layout-boxed", "layout-top-nav", "sidebar-collapse",
  232. | "sidebar-mini".
  233. |
  234. */
  235. 'layout' => ['sidebar-mini', 'sidebar-collapse'],
  236. /*
  237. |--------------------------------------------------------------------------
  238. | Login page background image
  239. |--------------------------------------------------------------------------
  240. |
  241. | 登录页面的背景图设置
  242. |
  243. */
  244. 'login_background_image' => '',
  245. /*
  246. |--------------------------------------------------------------------------
  247. | Show version at footer
  248. |--------------------------------------------------------------------------
  249. |
  250. | 是否在页面的右下角显示当前laravel-admin的版本
  251. |
  252. */
  253. 'show_version' => true,
  254. /*
  255. |--------------------------------------------------------------------------
  256. | Show environment at footer
  257. |--------------------------------------------------------------------------
  258. |
  259. | 是否在页面的右下角显示当前的环境
  260. |
  261. */
  262. 'show_environment' => true,
  263. /*
  264. |--------------------------------------------------------------------------
  265. | Menu bind to permission
  266. |--------------------------------------------------------------------------
  267. |
  268. | 菜单是否绑定权限
  269. */
  270. 'menu_bind_permission' => true,
  271. /*
  272. |--------------------------------------------------------------------------
  273. | 是否要开启路由权限检查
  274. |--------------------------------------------------------------------------
  275. */
  276. 'check_route_permission' => true,
  277. /*
  278. |--------------------------------------------------------------------------
  279. | 是否要开启菜单可见角色检查
  280. |--------------------------------------------------------------------------
  281. */
  282. 'check_menu_roles' => true,
  283. /*
  284. |--------------------------------------------------------------------------
  285. | Enable default breadcrumb
  286. |--------------------------------------------------------------------------
  287. |
  288. | 是否开启页面的面包屑导航
  289. */
  290. 'enable_default_breadcrumb' => true,
  291. /*
  292. |--------------------------------------------------------------------------
  293. | 是否开启静态资源文件的压缩
  294. |--------------------------------------------------------------------------
  295. */
  296. 'minify_assets' => [
  297. // 不需要被压缩的文件
  298. 'excepts' => [
  299. ],
  300. ],
  301. /*
  302. |--------------------------------------------------------------------------
  303. | 是否要开启侧边栏的菜单搜索
  304. |--------------------------------------------------------------------------
  305. */
  306. 'enable_menu_search' => true,
  307. /*
  308. |--------------------------------------------------------------------------
  309. | 用来设置顶部的文字提示.
  310. |--------------------------------------------------------------------------
  311. */
  312. 'top_alert' => '',
  313. /*
  314. |--------------------------------------------------------------------------
  315. | 设置数据表格的操作列显示类
  316. |--------------------------------------------------------------------------
  317. */
  318. 'grid_action_class' => \Encore\Admin\Grid\Displayers\DropdownActions::class,
  319. /*
  320. |--------------------------------------------------------------------------
  321. | Extension Directory
  322. |--------------------------------------------------------------------------
  323. |
  324. | 如果你要运行`php artisan admin:extend`命令来开发扩展,需要配置这一项,来存放你的扩展文件
  325. */
  326. 'extension_dir' => app_path('Admin/Extensions'),
  327. /*
  328. |--------------------------------------------------------------------------
  329. | Settings for extensions.
  330. |--------------------------------------------------------------------------
  331. |
  332. | 每一个laravel-admin扩展对应的配置,都写在这下面,扩展可以参考 https://github.com/laravel-admin-extensions
  333. |
  334. */
  335. 'extensions' => [
  336. ],
  337. ];

app/Admin/bootstrap.php

在这个配置文件中可以扩展或者移除你的组件,或者引入前端资源

  1. <?php
  2. /**
  3. * Laravel-admin - admin builder based on Laravel.
  4. * @author z-song <https://github.com/z-song>
  5. *
  6. * Bootstraper for Admin.
  7. *
  8. * Here you can remove builtin form field:
  9. * Encore\Admin\Form::forget(['map', 'editor']);
  10. *
  11. * Or extend custom form field:
  12. * Encore\Admin\Form::extend('php', PHPEditor::class);
  13. *
  14. * Or require js and css assets:
  15. * Admin::css('/packages/prettydocs/css/styles.css');
  16. * Admin::js('/packages/prettydocs/js/main.js');
  17. *
  18. */
  19. Encore\Admin\Form::forget(['map', 'editor']);