Загрузка...

Laravel 12 Tutorial #110 | Subscribers Feature | Build Subscribers Feature in Laravel 12

🔗Laravel 12 Multi-Vendor E-commerce Series Complete Playlist:
https://www.youtube.com/playlist?list=PLLUtELdNs2ZZ_hI7DvqrrhX-ASGD1U2Dl

Welcome to Part 110 of the Laravel 12 Multi-Vendor E-commerce Series, where we continue building a complete, professional multi-vendor e-commerce platform from scratch.

In this part, we implement the full Subscribers (Newsletter) functionality. Users can subscribe to the newsletter using email forms available on the homepage and footer, and their requests are processed via AJAX without refreshing the page.

We also build a complete Admin Subscribers Module with permissions, status toggle, delete functionality, and column visibility/order management — fully matching the structure of other admin modules.

✨ What We Implement in Part 110
1. Database Setup

A new table is created to store subscriber emails.
Each subscriber has an email, active/inactive status, and timestamps.

2. Subscriber Model

Handles mass assignment for email & status.
Includes a scope for fetching only active subscribers.

3. Frontend Request Validation

Validates the subscriber email.
Provides custom validation messages.

4. Frontend Service

Automatically converts email to lowercase and trims spaces.
Checks if the email already exists.
If already subscribed → shows appropriate message.
If inactive → reactivates subscription.
If new → adds subscriber and confirms successful subscription.

5. Frontend Controller

Receives validated email.
Calls the service to process subscription.
Returns JSON response for AJAX requests.
Handles non-AJAX fallback as well.

6. Routes Setup

Includes:
Front subscription route.
Admin module routes:
Subscribers listing
Status update
Delete subscriber

7. Admin Subscribers Controller

Includes:
View permissions
Edit permissions
Full permissions
Status toggle (Active/Inactive)
Delete function
Column visibility & column order preference

8. Admin Subscribers Service

Handles:
Fetching all subscribers
Permission-based access control
Status toggle logic
Delete subscriber functionality
Returns subscribers along with admin role permissions

9. Admin Subscribers Page (View)

The admin page includes:
List of all subscribers
Email display
Status toggle icon
Subscribed date
Delete button (depending on admin role)
Column ordering
Column visibility options
Fully DataTable-ready

10. Frontend Subscription Forms

Two forms are integrated:
Footer Subscribe Form
Homepage Subscribe Section

Each form includes:
Email field
Subscribe button
AJAX-based response alerts

11. AJAX Scripts

Two AJAX scripts included:
Footer subscription form
Homepage subscription form

Features:

Sends JSON request with CSRF token
Handles all server responses
Shows success/error messages instantly
Clears input on success
Disable/enable button with loading text
Handles network issues gracefully

12. Admin Status Toggle JavaScript

Already aligned with your existing admin modules:
Toggles subscriber status via AJAX
Updates toggle icon without refreshing the page

🎉 Final Result

The Newsletter Subscribers Module is now:
✔ Fully functional
✔ AJAX-powered on frontend
✔ Fully manageable from admin panel
✔ Permission-based
✔ Status toggle supported
✔ Delete supported
✔ Column visibility & ordering supported
✔ Matches all other modules structurally

📢 Don’t forget to Like, Share & Subscribe for more Laravel tutorials! 🚀

🔗Bookmark & follow this Laravel 12 Multi-Vendor E-commerce Series:
https://www.youtube.com/playlist?list=PLLUtELdNs2ZZ_hI7DvqrrhX-ASGD1U2Dl

►Click here to subscribe for Laravel & other updates - https://www.youtube.com/stackdevelopers

Popular Stack Developers Series that can help you:-

►Laravel 12 Tutorial (with MySQL): https://www.youtube.com/playlist?list=PLLUtELdNs2ZbqkUOd-oXHemay3BrsqZqC

►Laravel 11 Tutorial (with MongoDB): https://www.youtube.com/playlist?list=PLLUtELdNs2ZYTn3ft4BMaAilhZJYLMs9d

►Laravel 11 PostgreSQL Tutorial: https://www.youtube.com/playlist?list=PLLUtELdNs2ZZy4jI-wu4jYUL7rbvC8Mgh

►Laravel API Tutorial - https://www.youtube.com/playlist?list=PLLUtELdNs2ZbcCsd4yAAiBU2L3ROREk8P

►jQuery Tutorial - https://www.youtube.com/playlist?list=PLLUtELdNs2ZbMYoUA46GIonOH29KcjtxA

►Laravel Basic E-commerce Series - https://www.youtube.com/playlist?list=PLLUtELdNs2ZY5drPxIWzpq5crhantlzp7

►Join this channel to get the complete source code of all series:
https://www.youtube.com/channel/UCExO2i-tLU1NyVZD6zOJQlw/join

Follow Stack Developers on Social Media to get updates and resolve your queries
►Like Facebook Page to get updates - http://facebook.com/stackdevelopers2/
►Join Facebook Group to resolve your queries - http://facebook.com/groups/stackdevelopers
►Follow on Instagram - https://www.instagram.com/stackdevelopers2/
►Follow on GitHub - https://github.com/stackdevelopers

#Laravel12 #LaravelEcommerce #MultiVendor #EcommerceDevelopment #WebDevelopment #LaravelTutorial

Видео Laravel 12 Tutorial #110 | Subscribers Feature | Build Subscribers Feature in Laravel 12 канала Stack Developers
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять