Hi all,
With help from the forum, my package is progressing bit by bit.
Most things work now, but one thing is causing some trouble: creating the first/single user during install.
The app is built on Laravel/Composer, Artisan Tinker provides a way to insert a user into the app via the command line. The command runs fine if I run it manually after installation, but integrating the command into the install script makes the install break at that point.
Here in an excerpt from the install log:
Info: DEBUG - Database\Seeders\LabelsSeeder ......................................................................... RUNNING
Info: DEBUG - Database\Seeders\LabelsSeeder ....................................................................... 5 ms DONE
Info: DEBUG -
Info: DEBUG - + php artisan tinker
Info: DEBUG - = App\Models\User {#6290
Info: DEBUG - name: "testuser",
Info: DEBUG - email: "testuser@domain.tld",
Info: DEBUG - #password: "$2y$10$vkJ19Qa8.mOUbMK7Ed3kmuDgtmJFOrtrV3UbkgjLBjkniJ6LeZkOO",
Info: DEBUG - api_token: "**********",
Info: DEBUG - updated_at: "2025-03-03 14:36:46",
Info: DEBUG - created_at: "2025-03-03 14:36:46",
Info: DEBUG - id: 1,
Info: DEBUG - }
Info: DEBUG -
Info: DEBUG - + ynh_exit_properly
Warning: Removing the app after installation failureā¦
Info: [++++++++++..........] > Removing system configurations related to my_idlers...
Info: [####################] > Removal of my_idlers completed
The corresponding commands in the install script are:
"php$php_version" artisan migrate:fresh --seed -n --force
echo "use App\Models\User; User::create(['name' => '$user', 'email' => '$email' , 'password' => bcrypt ('$password'), 'api_token' => '$token']); " | php artisan tinker
"php$php_version" artisan config:clear -n
At first I had the echo "use App\... tinker
-line under the other artisan lines; in that case config:clear runs fine and it still breaks on the tinker
line after that. As you see in the log, the command gets executed, it is after immediately that that the install gets broken off.
I may be blissfully using the wrong technique to populate the database with a first user; if so, please guide me in the right direction!
As an aside, last days I pushed my changes to Github as well, but this morning Github declared my public key invalid. I havenāt looked into the cause yet. How do you guys push changes to Github?