Category: Laravel 6
-
Post Views: 20 1. Use database transactions in Laravel 6’s Eloquent ORM. The application only uses PHP 7.0 and later, so replace \Exception with \Throwable. Reference:https://stackoverflow.com/questions/49814785/how-can-i-use-transaction-with-eloquent-laravel-5-5 2. The final implementation code is as follows 3. When the transaction fails specially, the third model is inserted into a non-existent field, the transaction is rolled back, and the data is not inserted…
-
Post Views: 19 1. In Laravle 6’s database migration, the data table option does not support adding comments. as shown in Figure 1 2. Reference:https://stackoverflow.com/questions/37493431/how-to-add-comment-to-table-not-column-in-laravel-5-migration. How to add comment to table (not column) in Laravel 5 migration? 3. The final realization is as follows 4. After performing the database migration, check the execution results, and the table comments have been…
-
Post Views: 22 1. Check the existing code, which is implemented based on the function app. The app function returns the service container instance. Unable to jump to the corresponding method by clicking getByName() . as shown in Figure 1 2. Refer to the automatic injection of the service container. You can simply inject the dependencies that require container resolution,…
-
Post Views: 15 1. Lighthouse uses a lot of SDL and uses mode instructions. In order to improve your editing experience, you can use the artisan command to generate a definition file. Error: Illuminate\Contracts\Container\BindingResolutionException : target[Modules\ThemeStore\View\ViewStorageInterface]Is not instantiable while building[Modules\ThemeStore\Resolver\OnlineStoreThemeResolver]. as shown in Figure 1 2. Execute the command: php artisan module:list to display a list of all modules. Confirm…
-
Post Views: 16 1. Error: Argument 1 Passed to App\\Exceptions\\Handler::report() must be an instance of exception, instance of typeError given, called in E:\WWRoot\\Object\Vendor\\nuwave\Lighthouse\src\execution\\reportingErrorHandler.php on line 40. as shown in Figure 1 2. Reference URL:https://www.shuijingwanwq.com/en/2022/01/26/9945/. Caused by version compatibility issues. Edit /vendor/nuwave/lighthouse/src/execution/reportingErrorHandler.php. Print $error. Message: Argument 1 Passed to Nuwave\Lighthouse\Schema\TypeRegistry::get() must be of the type string, array given, Called in E:\WwWroot\Object\Vendor\NuWave\Lighthouse\src\Schema\Typeregistry.php…
-
Post Views: 17 1. When the language area is en , when the validated parameter does not exist, the response: The selected theme ID is invalid. as shown in Figure 1 2. When the language area is zh_cn, when the validated parameter does not exist, the response: the selected Theme ID is invalid. Expected: The selected theme ID is invalid.…
-
Post Views: 17 1. In the program implementation, first request the API to generate a cache ID. Then request the API, delete the cache ID. as shown in Figure 1 2. If you want to pass in the test, the premise is that there must be a clear cache ID to delete the parameters of the request. 3. Reference URL:https://learnku.com/laravel/t/22690.…
-
Post Views: 18 1. At this stage, you need to implement an interface to delete the cache ID in the GraphQL API. Refer to the Shopify example. When the cache ID does not exist, the response fails. as shown in Figure 1 2. Due to the rule to verify whether this cache ID exists, it will be used in a…
-
Post Views: 17 1. When using Redis with Laravel, there are two solutions, one is to install the phpredis php extension, and the other is to install the predis/predis package through composer. However, Predis has been abandoned by the original author of the package and may be removed from Laravel in future releases. It was finally decided to use the…