Tag: Laravel
-
Post Views: 15 1. The initial response structure is as follows: as shown in Figure 1 2. Since paging is not required, the front end wants to remove the package data key of the outermost resources, and set the “data” wrapper to null. Modify the resource collection class as follows 3. The result is as expected, and the interface…
-
Post Views: 17 1. Reference: In mysql 8.0, when the total number of table records is checked, the analysis and optimization of the timeout is optimized. Add WHERE ID > 0 when a COUNT SQL does not exist where condition exists. 2. Reference:How to check if table is already has a where Clause in Laravel Query Builder? The final implementation…
-
Post Views: 16 1. In Laravel 6, you need to query the penultimate record. as shown in Figure 1 2. Based on the reverse order, use LIMIT, the code is implemented as follows 3. The printing results are in line with expectations. as shown in Figure 2
-
Post Views: 16 1. In Laravel, when responding to 404 in the middleware, an error is reported: View[components.css]not found. as shown in Figure 1 2. Check the corresponding topic, confirm that the file /resources/views/view_object/components/css.blade.php exists. as shown in Figure 2 3. The same response of 404 code, error in the middleware: View[components.css]not found. Response 404 in the controller method. Print…
-
Post Views: 20 1. In the API response, the field: “Processing”: False, . as shown in Figure 1 2. The type of field processing is tinyint(1). Its value is 0, 1. as shown in Figure 2 3. The original implementation is as follows 4. The $casts property in the model provides a convenient way to convert attributes to common data…
-
Post Views: 18 1. Print the current object, its properties[architecture]=> 2.0 . as shown in Figure 1 2. The code is implemented as follows 3. Print object $wptheme, its attributes[architecture]=> 2.0. Print $wptheme->Architecture with a value of 1.0. Not as expected. as shown in Figure 2 4. Finally found the reason, the influence of the settings in the model file,…
-
Post Views: 23 1. To set the configuration value at runtime, pass an array to the config function, which is reset in the middleware 2. The Singleton method binds a class or interface to a container that is only parsed once. Once the singleton binding is resolved, the same object instance will be returned to the container in subsequent calls.…
-
Post Views: 24 1. The correlation of the model Theme is as follows 2. The correlation of the model ThemeInstallation is as follows 3. Error when obtaining the associated attribute: sqlstate[42S02]: base table or view not found: 1146 tableObject_wp.wp_theme_installationdoesn’tt exist . as shown in Figure 1 4. The table Theme_Installation does not exist in object_wp.wp_theme_installation, but actually exists in…