Laravel Tinker is a powerful REPL for testing your Laravel code interactively. This mini project helps beginners understand how to use Tinker effectively with real examples.
git clone https://github.com/yourusername/laravel-tinker-playground.git
cd laravel-tinker-playground
composer install
cp .env.example .env
php artisan key:generate
Make sure to configure your .env
file for a local MySQL setup.
php artisan migrate
php artisan db:seed
php artisan tinker
- Basic Eloquent Queries:
User::all()
,Post::find(1)
- Creating Records using
User::create()
- Using Factories
- Relationship Testing:
User::find(1)->posts
,Post::find(1)->user
- Simulating Auth:
auth()->login(User::find(1))
- User (hasMany Posts)
- Post (belongsTo User)
- Laravel beginners learning Eloquent
- Experimenting before writing controllers
- Debugging model logic