LARAVEL Communication & Stakeholder Relations 2 — Questions and Answers
Question 1: Which Laravel class is used to send HTTP requests to external APIs and stakeholder services?
- Illuminate\Http\Client\Http
- Illuminate\Support\Facades\Http (Correct answer)
- Illuminate\Http\Request
- Illuminate\Support\Facades\Curl
Correct answer: Illuminate\Support\Facades\Http
Laravel's Http facade (Illuminate\Support\Facades\Http) wraps Guzzle to provide a fluent API for making outbound HTTP requests.
Question 2: When broadcasting a Laravel event to WebSocket clients, which method on the event class defines the channel?
- broadcastOn() (Correct answer)
- broadcastWith()
- broadcastAs()
- broadcastQueue()
Correct answer: broadcastOn()
The broadcastOn() method returns the channel(s) on which the event should be broadcast to connected clients.
Question 3: A stakeholder requests real-time dashboard updates in your Laravel app. Which driver is NOT a valid Laravel broadcasting driver?
- Pusher
- Ably
- Socket.io (Correct answer)
- Reverb
Correct answer: Socket.io
Socket.io is a JavaScript library, not a Laravel broadcasting driver; Laravel supports Pusher, Ably, and its own Reverb server.
Question 4: You need to send a Slack notification to a project channel when a build fails. Which Laravel notification channel package handles this?
- laravel/slack-notification-channel (Correct answer)
- laravel/socialite
- laravel/horizon
- laravel/echo
Correct answer: laravel/slack-notification-channel
The laravel/slack-notification-channel package provides the Slack channel for Laravel notifications.
Question 5: What does the `via()` method return in a Laravel Notification class?
- The notification payload array
- An array of delivery channel strings (Correct answer)
- The notifiable model instance
- The queue connection name
Correct answer: An array of delivery channel strings
The via() method returns an array of channel names (e.g., ['mail', 'database', 'slack']) through which the notification should be delivered.
Question 6: Which artisan command generates a new Laravel Notification class?
- php artisan make:event
- php artisan make:mail
- php artisan make:notification (Correct answer)
- php artisan make:listener
Correct answer: php artisan make:notification
php artisan make:notification generates a new Notification class in the app/Notifications directory.
Question 7: A client wants webhook callbacks when orders ship. Where in Laravel should you validate the incoming webhook signature?
- In the Eloquent model's booted() method
- In a dedicated middleware or controller before processing (Correct answer)
- In the AppServiceProvider register() method
- In the route's cache configuration
Correct answer: In a dedicated middleware or controller before processing
Webhook signature validation belongs in middleware or at the top of the controller action before any business logic is executed.
Which Laravel class is used to send HTTP requests to external APIs and stakeholder services?