Laravel 12 introduces powerful new Artisan commands that streamline development workflows, enhance debugging, and improve efficiency. This guide explores these new commands with practical examples, making it easier for Laravel developers to boost productivity. What is Artisan? Artisan is Laravel’s built-in command-line interface (CLI), providing a wide range of commands to automate tasks such as […]
Laravel 12 introduces powerful new Artisan commands that streamline development workflows, enhance debugging, and improve efficiency. This guide explores these new commands with practical examples, making it easier for Laravel developers to boost productivity.
Artisan is Laravel's built-in command-line interface (CLI), providing a wide range of commands to automate tasks such as migrations, queue management, caching, and more. With Laravel 12, new Artisan commands further simplify application development.
php artisan model:show {model}
🔹 Description: Displays detailed information about a specific Eloquent model.
🔹 Usage:
php artisan model:show User
🔹 Output Example:
Model: App\Models\User
Table: users
Columns:
- id (integer, primary key)
- name (string)
- email (string, unique)
- created_at (timestamp)
- updated_at (timestamp)
Relationships:
- hasMany: App\Models\Post
🔹 Why It’s Useful?
php artisan cache:clear --tags=tag1,tag2
🔹 Description: Clears cache for specific tags rather than wiping all cached data.
🔹 Usage:
php artisan cache:clear --tags=user_cache,settings
🔹 Why It’s Useful?
php artisan queue:failed --since=1h
🔹 Description: Lists failed queue jobs within a specified timeframe.
🔹 Usage:
php artisan queue:failed --since=1h
🔹 Why It’s Useful?
php artisan event:list --only=custom
🔹 Description: Lists only custom application events instead of all system and framework events.
🔹 Usage:
php artisan event:list --only=custom
🔹 Why It’s Useful?
php artisan db:monitor
🔹 Description: Continuously monitors database connections and queries in real-time.
🔹 Usage:
php artisan db:monitor
🔹 Why It’s Useful?
🔹 php artisan test --parallel
→ Runs test suites in parallel, speeding up execution.
🔹 php artisan migrate:status --detailed
→ Shows migration history with timestamps and statuses.
Laravel 12’s new Artisan commands significantly enhance developer productivity. From debugging queue failures to monitoring databases, these additions streamline workflows and optimize performance. If you're looking for custom Laravel development, let’s build something amazing together! 🚀