Traits use in laravel/lumen for standard response

Traits are a mechanism for code reuse in single inheritance languages such as PHP. A Trait is intended to reduce some limitations of single inheritance by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies. The semantics of the combination of Traits and classes is defined in a way which reduces complexity, and avoids the typical problems associated with multiple inheritance and Mixins.

Task Scheduling in Laravel/Lumen

The Laravel framework allows you to set up scheduled tasks so that you don't have to worry about setting them up at the system level. You can get rid of that complex cron syntax while setting up scheduled tasks since Laravel allows you to define them in a user-friendly way.

Here’s a text representation that should clarify how cron works

Laravel - Lock wait timeout exceeded

Problem description:
I have a transaction in my code ,if an error occurs in executing in this transactions that doesn't trigger commit or rollback,
then the database is locked and any subsequent attempts to access the database results in this:

Transactions with eloquent in laravel

You may use the transaction method on the DB facade to run a set of operations within a database transaction. If an exception is thrown within the transaction Closure, the transaction will automatically be rolled back. If the Closure executes successfully, the transaction will automatically be committed. You don't need to worry about manually rolling back or committing while using the transaction method:

Use the Repository Design pattern to refactor app's controller

First , we create a RepositoryInterface as a contract that defines the methods a class MUST have defined.

WeChat mini program login args and returns

Run commands to dispatch a event

1. Create MassiveLocalFilesParse.php under MassiveLocalFilesParse.php folder

ReflectionClass and IoC demonstration

PHP 5 comes with a complete reflection API that adds the ability to reverse-engineer classes, interfaces, functions, methods and extensions. Additionally, the reflection API offers ways to retrieve doc comments for functions, classes and methods.

The ReflectionClass class reports information about a class:

Installation and configuration of elastic server, vuejs and lumen for advanced search

Elastic Search performs real-time distributed search and analysis. In short, it is a platform or engine that performs a full-text search. It has a growing popularity over the years. It has powerful features and is easy to configure and uses RESTful API.

Let us try and understand the Elasticsearch basics in its pure form:


Vue, Laravel echo + + lumen(event, listener)

一: Laravel echo + Vue
1. First install socket-client, laravel-echo package for vuejs


Subscribe to RSS - Laravel