Masonite Tinker is a powerful REPL (Read, Evaluate, Print and Loop) environment for the Masonite framework. It's a supercharged Python interactive shell with access to the container, models and helpers.
Tinker allows you to interact with your entire Masonite project on the command line, including models, jobs, events, and more. To enter the Tinker environment, run the tinker command:
#Install Ipython
pip install IPython
#Now enter to tinker shell
python craft tinker -i
Now, let's try some command to interact with our DB.
Create a new user
User.create({
"name": "Joe",
"email": "joe@masoniteproject.com",
"password": "secret"
})
Query the first user in our DB
User.first().serialize()
Update the name of our first user
User.find(1).update({"name": "Theo"})
Retrieve configuration values from application.py
config("application.key")