# การแจ้งเตือนและเมล (Laravel) > การตั้งค่า mail, mailables, markdown mail, การแจ้งเตือน, ช่องทางการแจ้งเตือน, การแจ้งเตือนจากฐานข้อมูล, การแจ้งเตือนแบบคิว - 20 คำถามสัมภาษณ์ - Mid-Level - [คำถามสัมภาษณ์: Laravel](https://sharpskill.dev/th/technologies/laravel/interview-questions.md) ## 1. Mailable ใน Laravel คืออะไร? **คำตอบ** Mailable คือคลาส PHP ที่แทนอีเมลใน Laravel โดยจะรวมตรรกะทั้งหมดในการสร้างอีเมล (ผู้รับ หัวข้อ เนื้อหา ไฟล์แนบ) ไว้ในคลาสที่นำกลับมาใช้ใหม่และทดสอบได้ แนวทางเชิงวัตถุนี้ช่วยให้ดูแลรักษาง่ายขึ้นและช่วยแยกตรรกะทางธุรกิจออกจากการแสดงผลอีเมล ## 2. คำสั่ง artisan ใดที่สร้างคลาส Mailable ใหม่? **คำตอบ** คำสั่ง make:mail จะสร้างคลาส Mailable ใหม่ในไดเรกทอรี app/Mail พร้อมโครงสร้างพื้นฐานที่จำเป็นโดยอัตโนมัติ คำสั่งนี้สร้างโครงร่างที่มีเมธอด envelope สำหรับกำหนดหัวข้อและผู้รับ, content สำหรับเทมเพลต และ attachments สำหรับไฟล์แนบ ช่วยเร่งการพัฒนาได้อย่างมากโดยหลีกเลี่ยงการสร้างด้วยตนเอง ## 3. ช่องทางเริ่มต้นที่การแจ้งเตือนของ Laravel ใช้หากไม่ได้ระบุช่องทางคืออะไร? **คำตอบ** โดยค่าเริ่มต้น หากไม่มีการคืนค่าช่องทางอย่างชัดเจนในเมธอด via Laravel จะไม่ใช้ช่องทางอัตโนมัติใด ๆ จำเป็นต้องกำหนดช่องทางในเมธอด via ของการแจ้งเตือนเพื่อกำหนดว่าจะส่งอย่างไร ช่องทางทั่วไปได้แก่ mail, database, broadcast, nexmo และ slack แต่การใช้งานต้องถูกประกาศอย่างชัดเจน ## มีอีก 17 คำถาม - จะกำหนดหัวข้อของอีเมลในคลาส Mailable ได้อย่างไร? - เมธอดใดของคลาส Notification ที่กำหนดช่องทางการส่ง? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ Laravel อื่นๆ - [พื้นฐาน PHP](https://sharpskill.dev/th/technologies/laravel/interview-questions/php-basics.md): 25 คำถาม, Junior - [พื้นฐาน OOP ใน PHP](https://sharpskill.dev/th/technologies/laravel/interview-questions/php-oop-essentials.md): 20 คำถาม, Junior - [Composer & Autoloading](https://sharpskill.dev/th/technologies/laravel/interview-questions/composer-autoloading.md): 18 คำถาม, Junior - [พื้นฐาน Laravel](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-fundamentals.md): 20 คำถาม, Junior - [Laravel Routing](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-routing.md): 20 คำถาม, Junior - [Blade Templates](https://sharpskill.dev/th/technologies/laravel/interview-questions/blade-templates.md): 18 คำถาม, Junior - [Request & Response](https://sharpskill.dev/th/technologies/laravel/interview-questions/request-response.md): 20 คำถาม, Junior - [พื้นฐาน Eloquent ORM](https://sharpskill.dev/th/technologies/laravel/interview-questions/eloquent-orm-basics.md): 22 คำถาม, Junior - [Eloquent Relationships](https://sharpskill.dev/th/technologies/laravel/interview-questions/eloquent-relationships.md): 25 คำถาม, Mid-Level - [Migrations & Schema Builder](https://sharpskill.dev/th/technologies/laravel/interview-questions/database-migrations.md): 20 คำถาม, Mid-Level - [การตรวจสอบและฟอร์ม](https://sharpskill.dev/th/technologies/laravel/interview-questions/validation-forms.md): 22 คำถาม, Mid-Level - [การยืนยันตัวตน](https://sharpskill.dev/th/technologies/laravel/interview-questions/authentication.md): 20 คำถาม, Mid-Level - [การให้สิทธิ์และ Policies](https://sharpskill.dev/th/technologies/laravel/interview-questions/authorization-policies.md): 18 คำถาม, Mid-Level - [API Resources & Authentication](https://sharpskill.dev/th/technologies/laravel/interview-questions/api-resources-authentication.md): 26 คำถาม, Mid-Level - [Middleware](https://sharpskill.dev/th/technologies/laravel/interview-questions/middleware.md): 18 คำถาม, Mid-Level - [Service Container & DI](https://sharpskill.dev/th/technologies/laravel/interview-questions/service-container-di.md): 20 คำถาม, Mid-Level - [Queues & Jobs](https://sharpskill.dev/th/technologies/laravel/interview-questions/queues-jobs.md): 22 คำถาม, Mid-Level - [Events & Listeners](https://sharpskill.dev/th/technologies/laravel/interview-questions/events-listeners.md): 18 คำถาม, Mid-Level - [File Storage](https://sharpskill.dev/th/technologies/laravel/interview-questions/file-storage.md): 18 คำถาม, Mid-Level - [Testing & PHPUnit](https://sharpskill.dev/th/technologies/laravel/interview-questions/testing-phpunit.md): 24 คำถาม, Mid-Level - [Caching](https://sharpskill.dev/th/technologies/laravel/interview-questions/caching.md): 18 คำถาม, Mid-Level - [Livewire & Inertia](https://sharpskill.dev/th/technologies/laravel/interview-questions/livewire-inertia.md): 20 คำถาม, Mid-Level - [Eloquent Advanced](https://sharpskill.dev/th/technologies/laravel/interview-questions/eloquent-advanced.md): 24 คำถาม, Senior - [Repository Pattern](https://sharpskill.dev/th/technologies/laravel/interview-questions/repository-pattern.md): 20 คำถาม, Senior - [Laravel Packages](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-packages.md): 20 คำถาม, Senior - [Performance Optimization](https://sharpskill.dev/th/technologies/laravel/interview-questions/performance-optimization.md): 22 คำถาม, Senior - [Security Best Practices](https://sharpskill.dev/th/technologies/laravel/interview-questions/security-best-practices.md): 22 คำถาม, Senior - [Laravel Octane](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-octane.md): 18 คำถาม, Senior - [Laravel Distributed Systems](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-distributed-systems.md): 22 คำถาม, Senior - [Observability & Monitoring](https://sharpskill.dev/th/technologies/laravel/interview-questions/observability-monitoring.md): 20 คำถาม, Senior - [Deployment & DevOps](https://sharpskill.dev/th/technologies/laravel/interview-questions/deployment-devops.md): 20 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/laravel/interview-questions/notifications-mail