Category: Laravel
-
Post Views: 16 1. The current collection format is as follows 2. If you need to look up based on id, the firstwhere method returns the first element in the collection with a given key/value pair 3. Now you need to look up based on the two key-value pairs of name and email. The first method returns the first element…
-
Post Views: 22 1. Reference: In MySQL 8, the IN condition is used for multiple fields. 2. When you need to use the native expression query in Laravel 9, the in condition is used for multiple fields. WhereRaw and OrwhereRaw methods inject the native “Where” into your query. 3. Execute error: sqlstate[42000]: Syntax error or access Violation: 1064 you have…
-
Post Views: 19 1. In Laravel 9, a list of APIs has now been implemented, which is based on Spatie\QueryBuilder\QueryBuilder to easily build Eloquent queries from API requests. However, now you need to implement a function of exporting Excel on the list page, planned to be implemented in asynchronous queues. So, if you want to reuse the code that built…
-
Post Views: 63 1. Error: class “vtifulkernelexcel” not found. 2. The reason is that the extension php-ext-xlswriter is not installed. 3. GitHub Release: https://github.com/viest/php-ext-xlswriter/releases download php-windows-xlswriter-cf7e1933-8.1-ts-vs16-x64.zip. as shown in Figure 1 4. After decompression, copy php_xlswriter.dll to C:php-8.1.27extphp_xlswriter.dll 5. Edit php.ini, add extension=xlswriter 6. After restarting php, the error is reported again:[ERROR]workbook_close(): error creatingE:WWWRootObjectStorageAppExport/Order/Order Export Task 2024-02-19 10:24:06.xls. error =…
-
Post Views: 15 1. In Laravel 9, after executing redis::set($this->rules_update_key, carbon::now()); and found that the written value is Object. as shown in Figure 1 2. But in the test environment, the written value is a datetime string. Its value: 2024-01-30 06:00:00. as shown in Figure 2 3. The final comparison found that the root of the difference is that in…
-
Post Views: 16 1. Set the default value of DateTime in MySQL 8.0 to be0000-00-00 00:00:00Time error: sqlstate[42000]: Syntax error or access Violation: 1067 Invalid default value forOPERATED_AT_GMT. as shown in Figure 1 2. Reference:https://www.shuijingwanwq.com/2022/09/28/6993/In Navicat for MySQL, when the table is copied from one database to another, an error is reported:[ERR]1292 – Incorrect DateTime Value: ‘0000-00-00 00:00:00’ for column…
-
Post Views: 19 1. In Laravel 9, when executing: php artisan telescope:install error: error there are no commands defined in the “teleScope” namespace.. as shown in Figure 1 2. Discover the config/app.php configuration file of the TeleScopeServiceProvider service provider in the application configuration file that has been deleted. Add it back first. as shown in Figure 2 3. Run again:…
-
Post Views: 21 1. Reference:In Laravel 6, during the execution of the queue, the execution of each task will execute view::addLocation($location); however, each task will only take the $location of the first task. . However, it is found that there are still problems in the subsequent production environment. During queue execution, some view files are not executed (“Setting_Migrations”:[]). as shown…
-
Post Views: 15 1. Now you need to take the URI format data from a one-dimensional array. The print result of a one-dimensional array, as shown in Figure 1 2. The implementation is as follows based on the filter_var code, and the printing result is as follows, which does not meet the expectations, which exists: internal://policy_pages/29 3. Obtain the scheme…