Migrating Legancy Laravel 4 project to Laravel 7
General steps to follow: 1 New laravel project setup with latest laravel framework version. 2 namespace setup for whole app 3 composer.json migration 3.1 find correct version for all old…
General steps to follow: 1 New laravel project setup with latest laravel framework version. 2 namespace setup for whole app 3 composer.json migration 3.1 find correct version for all old…
For the past two weeks I’ve been developing payment procedures for some company’s international business. Basically this company has branches in 5 different countries spanning across different time zones and…
I have been scratching my head for a few hours on migrating GA to GTM this week. This project used google analytics and now customer wants GTM with more freedom…
Usually I find it hard for me to compose raw sql than to write queries using ORM. Here’s a case I did recently. In my opinion sometimes there’s no good…
I’ve been working on migrating a legacy laravel 4.2 project to Laravel 7.2 recently. And I’ve written some feature test cases and artisan command test cases as well as laravel…
soure code of authServiceProvidor:
http://docs.apiato.io/getting-started/installation/ 3rd party api-ato library:
https://www.script-tutorials.com/design-patterns-in-php/ https://nicole929chan.wordpress.com/category/solid/ https://nicole929chan.wordpress.com/category/tdd-%E7%B7%B4%E7%BF%92/
helpers: logger() 或者 Log门面Illuminate\Log\Logger 你可以使用 Log 门面记录日志信息,如上所述,日志系统提供了定义在 RFC 5424 规范中的八种日志级别:emergency、alert、critical、error、warning、 notice、info 和 debug: Path helpers: Str::slug() Arr:has() Str::uuid() Arr::pluck()
Defining model in Laravel Overide default database table name Overide default database table primary key Time stamps 时间戳 指定数据库连接 获取模型数据 Query Scopes /范围查询
simple operation 2. database transaction 4. on table() operations 查询 根据主键id查询数据 Multiple tables 关联表查询 join 插入 更新/修改 删除
Copy your json format data file to one of Laravel’s directories, preferably database. create a seeder file: php artisan make:seeder JsondataTableSeeder Modify the seeder class 4. Add the newly created…
One method to avoid a PHP pitfall of PUT and PATCH with _method hacking of POST. This is for Laravel 5. Avoid getting parameters from $request->input() which means getting data…
global middlewares are triggered before route middlewares in Laravel as you can see in the following source code from Laravel framework:
In public/index.php file, dd($app) before $response is returned, you will get $app itself printed in browser. ( Of course you should run php artisan serve to start the built-in web…
Mount linux file system under Macos: Laravel frequently used references: Laravel-mix webpack.mix.js example: package.json example (using Vue.js): Laravel blade template system interpolation V.S. Vue.js interpolation: Content distribution( in Vue.js) as…
Laravel 多个中间件的执行顺序 问题 一个路由需要用到多个中间件,其中一个是 Laravel 自带的 auth 中间件。 发现这个中间件不管放在哪里,总是在自定义中间件之前执行。 如果业务需要自定义中间在 auth 之前执行,还是有办法的。 解决方案 观察定义中间件的 app\Http\Kernel 类,是继承的 Illuminate\Foundation\Http\Kernel 类。 再打开 Illuminate\Foundation\Http\Kernel ,发现有这样一个数组 注释里写得比较清楚了:列表中的中间件会按照顺序优先在其他中间件之前执行。 那么需要自定义中间件在 auth 之前执行,只需要在 app\Http\Kernel 重载这个数组就行了。 auth 中间件对应的类 \Illuminate\Auth\Middleware\Authenticate,…
When I was migrating an old web site written in PHP from under Apache2 to Nginx I met a strange problem that the site worked perfectly under Apache2 but crashed…
When building Laradock’s nginx image I met a prolbem like: group “www-data” in use . This is because the group www-data is already created in the default base image nginx:alpine….
When I was debugging a CI/CD open source project called piplin(http://piplin.com), I failed setting up a web socket connection between node.js server and the browser. The browser is using cocket.io-client…
When setting up a laravel project I came across this problem: Google search for this problem and I solved it by generating APP_key parameter. This problem happens when the APP_KEY…
origin: https://blog.csdn.net/m_nanle_xiaobudiu/article/details/80466702 一 Beanstalkd 是什么 Beanstalkd,一个高性能、轻量级的分布式内存队列系统 二 Beanstalkd 特性 优先级(priority) 注:优先级就意味 支持任务插队(数字越小,优先级越高,0的优先级最高) 延迟(delay) 注:延迟意味着可以定义任务什么时间才开始被消费,也就实现了定时任务(比如为了增加网站活跃性,增加定时评论,定时点赞功能) 持久化(persistent data) 注:Beanstalkd 支持定时将文件刷到日志文件里,即使beanstalkd宕机,重启之后仍然可以找回文件 预留(buried) 注:Beanstalkd支持把一个任务设置为预留,这样,消费者就无法取出这个任务了,等合适的时机再把这个任务拿出来消费 任务超时重发(time-to-run) 注:消费者必须在指定的时间内处理完这个任务,否则就认为消费者处理失败,任务会被重新放到队列,等待消费 三 管道(tube)与任务(job) 注:生产者生产任务,并根据业务需求将任务放到不同管道中,比如和注册有关的任务放到注册管道中,和订单有关的放到订单管道中 注:任务从进入管道到离开管道一共有5个状态(ready,delayed,reserved,buried,delete) 生产者将任务放到管道中,任务的状态可以是ready(表示任务已经准备好,随时可以被消费者读取),也可以是delayed(任务在被生产者放入管道时,设置了延迟,比如设置了5s延迟,意味着5s之后,这个任务才会变成ready状态,才可以被消费者读取) 消费者消费任务(消费者将处于ready状态的任务读出来后,被读取处理的任务状态变为reserved) 消费者处理完任务后,任务的状态可能是delete(删除,处理成功),可能是buried(预留,意味着先把任务放一边,等待条件成熟还要用),可能是ready,也可能是delayed,需要根据具体业务场景自己进行判断定义 具体示意图:…
JITAMIN is a project management system written in PHP With Kanban as its main project tool. It has laravel-like directory structure, but in fact uses different packages like Pimple for…
魔术方法:两个下划线开头的格式。 PHP中的魔术方法总结 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep, __wakeup, __toString, __set_state, __clone and __autoload ①__get、__set这两个方法是为在类和他们的父类中没有声明的属性而设计的__get( $property ) 当调用一个未定义的属性时访问此方法(获取)__set( $property, $value ) 给一个未定义的属性赋值时调用(设置)这里的没有声明包括当使用对象调用时,访问控制为proteced,private的属性(即没有权限访问的属性) ②__isset、__unset__isset( $property ) 当在一个不可访问的属性上调用isset()或empty()函数时被调用。__unset(…