1.view部分: 安装一个扩展包:Laravel-UEditor composer require "overtrue/laravel-ueditor:~1.0" 配置 添加下面一行到 config/app.php 中 providers 部分: Overtrue\LaravelUEditor\UEditorServiceProvider::class, 发布配置文件与资源 php artisan vendor:publish --provider="Overtrue\La…
1.添加选择Topic 使用Select2,如何安装Select2 ,具体使用实例 Select2 and Laravel: Ajax Autocomplete 及 Loading data remotely in Select2 – Laravel 使用命令行: composer require select2/select2 完成后打开resources\app.scss,添加Select2: // Fonts @import url('https://fonts.googleapis.co…
1.话题[Topic] 执行命令: php artisan make:model Topic –cmr 修改****_**_**_create_topics_table.php数据库迁移文件如下: class CreateTopicsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('topics', function (Blu…
1.安装一个给用户提示的扩展包: 二选一: https://github.com/laracasts/flash [我选的这个]https://github.com/oanhnn/laravel-flash-message 使用方法:在需要使用falsh消息的控制器中,调用flash方法即可: 如: public function store() { //flash('Welcome Aboard!'); flash()->overlay('Welcome Aboard!', '登录提示');…
1.使用UEditor增量包: simple-ueditors 执行下载: git clone https://github.com/JellyBool/simple-ueditor.git 2.用此项目的 ueditor 目录替换原来的 public/vendor/ueditor 目录: 可以先删除原来的目录,移动simple-ueditor文件夹下ueditor整个文件夹的到public/vendor/目录里面,然后删除simple-ueditor目录即可: 3.实例化编辑器的时候配置 to…
1.本地化 由于所有blade默认采用的是 _('')方式输出标签文本,所以可以安装一个语言包,直接指定本地语言为zh_CN即可: 安装 https://github.com/caouecs/Laravel-lang 语言包: Laravel 5.8-6.0 版本: 在项目文件夹打开命令行,执行 composer require caouecs/laravel-lang:~4.0 Laravel 5.1-5.7 版本: 在项目文件夹打开命令行,执行 composer require caouec…
1.本节需要发送验证邮件 2.教程使用SendCloud发送邮件 [我使用的是mailtrap] 3. composer require laravel/ui 安装完成后 php artisan ui vue –auth 4.RegisterController中create方法内实现用户创建的默认值配置 class RegisterController extends Controller { /* |----------------------------------------------…
1.使用laragon新建laravel项目 zhihu 2.配置env文件的database设置 DB_DATABASE=zhihu 3.分析users表需要的字段 4.修改数据库迁移文件: class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Bluepri…
1.执行命令: php artisan make:model Models/Question -cm 2.设计问题的数据库迁移文件中的字段: <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateQuestionsTable extends Migration {…
上一节代码中已经实现 下面代码中的validate内部配置就是: public function store(Request $request) { // $data = $request->validate([ 'title' => 'required|min:8', 'content' => 'required|min:8', ]); $data['user_id'] = auth()->user()->id; $question = Question::create($…