Category: Web Framework
-
Post Views: 19 1. Define in the GraphQL schema file as follows 2. In the custom validator class Validator classes modules\\OnlineStoreEthemeGraphQL\\Validators\\UnpublishThemeValidator, the code is implemented as follows 3. The request verification failed, which is in line with expectations. as shown in Figure 1 4. Confirm the sql generated by the verification rule again, and generate the following. as shown in…
-
Post Views: 16 1. In Laravel 6, execute the UpdateOrCreate method to update the existing model or create a new model if it does not exist. The last generated sql is as follows, the field checksum is missing. as shown in Figure 1 2. The code is implemented as follows: 3. Print the variable $extra, and determine that the field…
-
Post Views: 15 1. There was an implementation before, which is to judge a specific record, whether it meets a certain complex nesting condition, and the code is implemented as follows 2. Now you need to query all records that meet this complex nesting condition, refer to:https://learnku.com/docs/laravel/6.x/queries/5171#2f5914, the code is implemented as follows 3. The final generated SQL is in…
-
Post Views: 13 1. Now there is a string with the following contents 2. It is expected to batch replace the default in the string to basic 3. Refer to the str::replaceArray function to replace the given value in the string using the array order 4. Since there is only one element in the array $replace, only one default is…
-
Post Views: 17 1. In Laravel 6, in the terminal, you can confirm that the queue has been executed. as shown in Figure 1 2. However, in Laravel Telescope, the status of the queuing job still shows that it is not finished. as shown in Figure 2 3. It is suspected that after updating Telescope, there is no reconfiguration and…
-
Post Views: 19 1. When the file module.json is deleted under modules/blog, a new migration file is generated: nwidart\modules\exceptions\moduleNotFoundException : module[Blog]does not exist!. as shown in Figure 1 2. Use the make:migration artisan command to create a migration, and use the –path option to customize the personal storage path that generates the migration file. as shown in Figure 2 3.…
-
Post Views: 62 1. Generate a new module: blog. 2. By default, the module class will not load automatically. You can load your modules automatically using PSR-4. Edit composer.json. as shown in Figure 1 3. Tip: Don’t forget to run composer dump-autoload. as shown in Figure 2 4. Generate a given console command for the specified module. 5. Edit CreatePostCommand.php,…
-
Post Views: 13 1. There are 2 fields in the table: original_theme_id, theme_id, the value of the field original_theme_id is derived from the theme_id of another record in the table. as shown in Figure 1 2. Set a one-to-one reverse association in the model. The code is implemented as follows 3. Get the code implementation of the associated attribute, the…
-
Post Views: 17 1. In MySQL 5.7, the data in the json type field is an array, and its value is:[365]. as shown in Figure 1 2. Reference: Query the constructor – where statement – json where statement:https://learnku.com/docs/laravel/6.x/queries/5171#35d9d9. JSON arrays can be queried using WhereJsonContains. as shown in Figure 2 3. The code is implemented as follows 4. Print the…