介绍
laravel-nestedset(Nested Set Model)
安装
composer require kalnoy/nestedset
用法
// database/migrations/2020_08_10_155445_create_category_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCategoryTable extends Migration
{
public function up()
{
Schema::create('categor...
作者为 站点默认 的文章:
当服务器宕机时,同一个页面的所有接口都会报错,导致页面出现一堆消息,本文方法可以让相同内容的消息只显示最后一个。
不支持 .error() 式的用法。
操作步骤
编辑 main.js,添加以下代码:
import { Message } from 'element-ui';
var MessageStack = [];
Vue.prototype.msg = function(config = {}) {
let msg = Message({
showClose: true,
...config,
onClose: function(msgHandle) {
typeof...
仅支持无感知验证,
vue-recaptcha-v3
yarn add vue-recaptcha-v3
src/main.js
import { VueReCaptcha } from 'vue-recaptcha-v3';
Vue.use(VueReCaptcha, {
siteKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
loaderOptions: {
// 是否使用国内的 recaptcha.net 域名
useRecaptchaNet: true,
// 是否隐藏“由reCAPTCHA 提供保护 隐私 - 使用条件”
autoHideBadge: process.env.N...
安装 Laravel
composer create-project laravel/laravel ./
修改依赖的下载源
composer global require slince/composer-registry-manager
composer repo:ls
composer repo:use aliyun
添加项目依赖
composer require doctrine/dbal # 增加修改表结构功能
composer require zedisdog/laravel-schema-extend # 增加表注释功能
composer require laravel/passport # OAuth
composer require spatie/laravel-permission # Permis...
问题
$this->validate
是因为所有控制器都使用了 ValidatesRequests Trait,所以可以使用这个 Trait
中提供的 validate() 方法
那 \App\Http\Requests 里的 validate () 方法是从哪里来的?最终实现是相同的吗?为什么会有两种写法?(我知道Validator::make() 是为了在 控制器外边用)
Laravel 代码如下:
$request->validate()
protected function validateLogin(\App\Http\Requests $request)
{
$request->...
Flutter 安装位置
~/Applications/flutter
Fish Shell
# ~/.config/fish/config.fish
set -gx PATH $PATH $HOME/.bin ~/Applications/flutter/bin
set -x PUB_HOSTED_URL https://pub.flutter-io.cn
set -x FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn
检测是否符合要求
flutter doctor
yarn config set -g registry https://registry.npm.taobao.org
yarn config set -g disturl https://npm.taobao.org/dist
yarn config set -g electron_mirror https://npm.taobao.org/mirrors/electron/
yarn config set -g sass_binary_site https://npm.taobao.org/mirrors/node-sass/
yarn config set -g phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
yarn config set -g chromedriver_cdnurl http...
创建 hotkey.ahk 并用 AutoHotKey 打开(功能与这里类似):
; -------------------------------------
; 用“Caps + 字符”打开/切换到指定软件
; # -> Win
; ! -> alt
; ^ -> control
; + -> shift
; -------------------------------------
; 用 CapsLock 代替 Ctrl + Alt + Win (仅组合键时,单按还是 CapsLock)
; via: https://stackoverflow.com/questions/40435980/how-to-emulate-hyper-key-in...
lua 数组去重
-- bArray = true 会把 t 当数组(连续的数字 key)
-- 默认是当作“对象(key可以不是数字)”
-- 或理解为是否保留原来的 key
function table.unique(t, bArray)
local check = {}
local n = {}
local idx = 1
for k, v in pairs(t) do
if not check[v] then
if bArray then
n[idx] = v
idx = idx + 1
else
...
为 sshd 添加一个 2222 端口
semanage port -a -t ssh_port_t -p tcp 2222
# 如需删除把 -a 换成 -d 。如果端口已经分配到其它地方,可以把 -a 换成 -m
查看 sshd 使用的端口
semanage port -l | grep ssh
# ssh_port_t tcp 2222, 22
查看 7100 端口的用途
semanage port -l | grep 7100
# xfs_port_t tcp 7100
把 7100 端口也给 shhd 用
semanage port -m -t ssh_port_t -p tcp 7100
# $ semana...
右键添加“用 Windows Terminal 在当前位置打开”
ContextMenu4WinTerminal.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\terminal]
@="Terminal Here"
"Icon"="C:\\Windows\\System32\\cmd.exe,0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\terminal\command]
@="C:\\Users\\usr\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe...
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: MySQL Baker 4 Windows
::
:: DATABASES=以空格分隔的库名或 --all-databases
::
:::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal enabledelayedexpansion
for /f "tokens=1-3 delims=-/ " %%1 in ("%date%") do set DATE_STR=%%1%%2%%3
set FILE_DATE=%DATE_STR: =0%
set FILE_PWD=123456
REM...