随笔分类 -  Laravel6实战开发漂亮博客

摘要:1,控制器 App\Http\Controllers\Index\ArticleController.php 上新增 search() 方法 <?php namespace App\Http\Controllers\Index; use App\Models\Admin\Article; use I 阅读全文
posted @ 2020-05-22 23:46 pensive2019 阅读(448) 评论(0) 推荐(0)
摘要:1,编辑 App\Http\Controllers\Index\ArticleController.php <?php namespace App\Http\Controllers\Index; use App\Models\Admin\Article; class ArticleControlle 阅读全文
posted @ 2020-05-22 21:48 pensive2019 阅读(190) 评论(0) 推荐(0)
摘要:1,直接复制前台首页模板index.blade.php 到 前台列表 模板 cate.blade.php 2,App\Http\Controllers\Index\CateController.php 前台栏目控制台修改为 <?php namespace App\Http\Controllers\I 阅读全文
posted @ 2020-05-22 17:51 pensive2019 阅读(117) 评论(0) 推荐(0)
摘要:1,直接复制CSS文件 到 \public\static\index\css\pagination.css #pull_right{ text-align:center; } .pull-right { /*float: left!important;*/ } .pagination { displ 阅读全文
posted @ 2020-05-22 16:46 pensive2019 阅读(168) 评论(0) 推荐(0)
摘要:1,App\Http\Controllers\Index\IndexController.php 修改前台首页的控制器为 <?php namespace App\Http\Controllers\Index; use App\Models\Admin\Article; class IndexCont 阅读全文
posted @ 2020-05-22 16:01 pensive2019 阅读(191) 评论(0) 推荐(0)
摘要:1, App\Http\Controllers\Index\CateController.php 栏目控制器index()方法 改成 分配当前栏目ID到模板 <?php namespace App\Http\Controllers\Index; class CateController extend 阅读全文
posted @ 2020-05-22 10:55 pensive2019 阅读(182) 评论(0) 推荐(0)
摘要:1,编辑前台公共控制器BaseController.php,新增 getCates()方法和hotArts()方法 ,并用构造函数 指向它们,使得数据可以被各模板接收到 <?php namespace App\Http\Controllers\Index; use App\Http\Controll 阅读全文
posted @ 2020-05-22 10:12 pensive2019 阅读(146) 评论(0) 推荐(0)
摘要:1,\resources\views\Index\Article\index.blade.php 模板名称改为 article.blade.php 并编辑代码如下 <html lang="zh-CN" class=" js flexbox canvas canvastext webgl no-tou 阅读全文
posted @ 2020-05-22 02:29 pensive2019 阅读(238) 评论(0) 推荐(0)
摘要:一、展示前台首页 1,命令行创建前台首页控制器 php artisan make:controller Index/IndexController 运行后,自动生成 App\Http\Controllers\Index\IndexController.php 2,在 \resources\views 阅读全文
posted @ 2020-05-22 01:14 pensive2019 阅读(314) 评论(0) 推荐(0)
摘要:1,复制下载到的 ueditor 文件夹到 \public\static 目录下 2,\resources\views\Admin\Article\ 目录下的 add.blade.php 和 edit.blade.php 都在头部引用相关JS 和 在底部增加js控制脚本 @section('js_h 阅读全文
posted @ 2020-05-21 23:14 pensive2019 阅读(198) 评论(0) 推荐(0)
摘要:1,\resources\views\Admin\Article\add.blade.php 的<form>表单增加 enctype="multipart/form-data"属性 <form class="form-horizontal" role="form" action="{{route(' 阅读全文
posted @ 2020-05-20 15:34 pensive2019 阅读(242) 评论(0) 推荐(0)
摘要:一、文章列表,新增、编辑和删除 1,编辑 App\Http\Requests\ArticleRequest.php 验证器 <?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; class Art 阅读全文
posted @ 2020-05-20 11:20 pensive2019 阅读(196) 评论(0) 推荐(0)
摘要:一、创建文章 Article 模型、迁移文件、控制器,验证器 1,创建模型同时创建迁移文件 php artisan make:model Models/Admin/Article -m 如图示 2,创建 Article 控制器,验证器的命令行命令分别是 php artisan make:contro 阅读全文
posted @ 2020-05-19 17:59 pensive2019 阅读(275) 评论(0) 推荐(0)
摘要:1,\resources\views\Admin\Cate\edit.blade.php 编辑为 @extends('Admin.Layout.main') @section('content') <!-- Page Breadcrumb --> <div class="page-breadcrum 阅读全文
posted @ 2020-05-19 16:02 pensive2019 阅读(268) 评论(0) 推荐(0)
摘要:1, 编辑 \resources\views\Admin\Cate\add.blade.php 完整代码如下 @extends('Admin.Layout.main') @section('content') <!-- Page Breadcrumb --> <div class="page-bre 阅读全文
posted @ 2020-05-19 15:35 pensive2019 阅读(247) 评论(0) 推荐(0)
摘要:一、创建文章分类cate模型、迁移文件、控制器,验证器 1,创建模型同时创建迁移文件 php artisan make:model models/Admin/Cate -m 如图示 2,创建cate控制器,验证器的命令行命令分别是 php artisan make:controller Admin/ 阅读全文
posted @ 2020-05-19 10:29 pensive2019 阅读(228) 评论(0) 推荐(0)
摘要:1,数据的删除包括【物理删除】和【软删除】2种,实际工作中以软删除比较多,类似 windows 上的回收站的功能。 找到 \resources\views\Admin\User\index.blade.php 管理员列表页的 删除 按钮,编辑 超链如下 <a href="#" onclick="bo 阅读全文
posted @ 2020-05-18 17:40 pensive2019 阅读(177) 评论(0) 推荐(0)
摘要:1, App\Http\Requests\UserRequest.php 修改 rules() 方法 不检验是否与所编辑 id 所对应的用户名重复 public function rules() { $id = $this->route('id'); return [ "username" => ' 阅读全文
posted @ 2020-05-18 11:56 pensive2019 阅读(366) 评论(0) 推荐(0)
摘要:1,\resources\views\Admin\User\edit.blade.php 的表单 form 的 action 修改为带ID参数的目的地址,method 用 post 方式 <form class="form-horizontal" role="form" action="{{rout 阅读全文
posted @ 2020-05-18 11:37 pensive2019 阅读(219) 评论(0) 推荐(0)
摘要:一、创建编辑页面 1,编辑 App\Http\Controllers\Controller\UserController.php 的 edit() 方法 public function edit(int $id){//$id是接收到的ID $user = User::find($id);//通过ID 阅读全文
posted @ 2020-05-17 13:57 pensive2019 阅读(174) 评论(0) 推荐(0)