# Magatunga - 2 — From Theme to Admin Foundation

We continued building the Magatunga project by transforming the static theme into a living Laravel application. The goal: turn the landing-page prototype into the backbone of a real learning platform with authentication, role and permission logic, and the beginnings of an admin workspace.

### **The challenge**

After the front-end theme was ready, the next step was to bring Laravel’s backend to life.  
We needed a foundation that could grow into a three-role system — **Admin**, **Teacher**, and **Student** — with permissions, dashboards, and a course structure flexible enough for both teaching and 1:1 sessions.

### **What we did**

* **Set up roles & permissions:**  
    Integrated `spatie/laravel-permission` to manage roles (Admin / Teacher / Student) and fine-grained permissions ([`courses.author`](http://courses.author), `courses.publish`, `one_to_one.offer`).  
    This gives us control over who can create, edit, or publish courses — a must for a scalable education platform.
    
* **Built the Admin Dashboard Shell:**  
    A responsive layout with sidebar, topbar, and avatar menu — ready for mobile.  
    Includes a logout button and profile edit link for each user.
    
* **Created the Course Metadata Editor:**  
    Admins can now create courses with titles, descriptions, prices (in cents server-side), and auto-generated slugs.  
    All new courses start as drafts to keep the workflow clean.
    
* **Implemented the Course Builder MVP:**  
    Courses can now be structured into Modules → Lessons → Blocks.  
    Supported block types so far: Text, Video, Audio, Quiz, Assignment, and Upload.  
    Blocks can be added, edited via modal dialogs, moved up or down, toggled active/inactive, and previewed.  
    After adding or editing, the interface automatically scrolls to the edited element for smooth navigation.
    
* **Soft Delete and Archive Handling:**  
    Courses can be archived and restored without data loss — for safe content management.
    

### **Result**

Magatunga has grown from a static landing page into a fully functional Laravel application with its own admin shell and content management structure.  
The Admin can create, build, and publish courses without touching code — and the foundation is ready for teacher and student workflows next.
