Posts by Hiro • 131 points
5 posts
-
2
votes2
answers78
viewsA: Factory of Relation N:N
To perform a rollback of all your test changes, you can use a trait within the test class. import to Databasetransactions and use within your test as follows. <?php namespace Tests\Feature; use…
-
0
votes2
answers562
viewsA: Use update method without using Edit, Laravel
Check in the model if the "api_access_key" field is in the array $fillable protected $fillable = [ 'api_access_key' ]; if you don’t have or the array doesn’t exist, create it with the columns you…
-
4
votes2
answers90
viewsA: Taking PHP array values
You can use the array_search with array_column. the array_column will separate the idEditor values, and the array_search will take the Dice of the array you are looking for $key = array_search('1',…
-
4
votes1
answer441
viewsA: User mock for testing in Laravel/Phpunit
The best way is by using Factories and Faker. You can use the command php artisan make:factory UserFactory. Factory will be created in the folder "/app/database/Factories/" In this file you can set…
-
0
votes2
answers97
viewsA: Unknown column 'b.id2' in 'Where clause'
try to change the column name as added below, probably you got confused at the time of putting the name and put id2, but this depends on the nomenclature you put, if not for sure enter here the…