Welcome! This guide will help you learn Laravel using this template.
After working through this template, you will understand:
- Laravel MVC architecture
- Authentication and authorization
- Database operations with Eloquent ORM
- Form handling and validation
- Routing and middleware
- Email notifications
- Frontend integration with Vite
- Read through the README.MD
- Explore the project folder structure
- Understand the purpose of each folder
- Set up the development environment
Resources:
- Open
routes/web.php - Study how routes are defined
- Learn about route groups and middleware
- Try creating a new route
Exercise: Create a route for /about page
Resources:
- Study
ProfileController.php - Understand controller methods
- Learn about dependency injection
- Create your own controller
Exercise: Create a PageController with an about() method
php artisan make:controller PageControllerResources:
- Review migrations in
database/migrations/ - Understand migration structure
- Create a new migration
- Run migrations
Exercise: Create a migration for a "posts" table
php artisan make:migration create_posts_table
php artisan migrateResources:
- Study the
User.phpmodel - Learn about mass assignment
- Understand model relationships
- Create a new model
Exercise: Create a Post model
php artisan make:model Post -mResources:
- Practice CRUD operations
- Learn query builder methods
- Understand eager loading
- Try complex queries
Exercise: Retrieve all posts with their authors
$posts = Post::with('user')->get();- Explore views in
resources/views/ - Learn Blade syntax
- Understand template inheritance
- Create a custom view
Exercise: Create a posts listing page
Resources:
- Study the authentication system
- Learn about middleware
- Understand password hashing
- Implement custom auth logic
Exercise: Add "Remember Me" functionality
Resources:
- Study validation in
ProfileController.php - Learn validation rules
- Create custom validation
- Handle validation errors
Exercise: Add validation for a contact form
Resources:
- Study
OtpPasswordResetNotification.php - Learn about notifications
- Configure mail settings
- Send test emails
Exercise: Create a welcome email notification
php artisan make:notification WelcomeNotificationResources:
- Plan a new feature (e.g., blog posts)
- Create necessary models and migrations
- Build controllers and views
- Test your feature
Goal: Add a simple blog to the template
Steps:
- Create Post model and migration
- Add posts table (title, content, user_id, timestamps)
- Create PostController with CRUD methods
- Build views for listing and showing posts
- Add routes for posts
- Implement authorization (only author can edit)
Goal: Categorize blog posts
Steps:
- Create Category model
- Set up many-to-many relationship
- Add category selection in post form
- Display categories on post pages
- Create category filter
Goal: Improve the role system
Steps:
- Study the existing
hakaksesmodel - Add more roles (admin, editor, viewer)
- Create middleware for each role
- Implement role-based permissions
- Add role management interface
- Code Along: Don't just read - type the code yourself
- Break Things: Experiment and see what happens
- Read Error Messages: They often tell you exactly what's wrong
- Use Laravel Tinker: Test code in the REPL
php artisan tinker
- Check Logs: Look in
storage/logs/when things go wrong - Ask Questions: Use GitHub issues or Laravel communities
- Build Projects: Apply what you learn in real projects
After each week, test your knowledge:
Week 1:
- What is the purpose of routes in Laravel?
- How do you pass data from a controller to a view?
- What is middleware used for?
Week 2:
- What is Eloquent ORM?
- How do you create a new database record?
- What's the difference between
get()andfirst()?
Week 3:
- What is Blade templating?
- How does Laravel hash passwords?
- What middleware protects authenticated routes?
Week 4:
- How do you validate form input?
- What are Laravel notifications?
- How do you send an email in Laravel?
Once you're comfortable with this template:
-
Build Your Own Project
- Apply what you've learned
- Start small and iterate
-
Learn Testing
- Write PHPUnit tests
- Learn about feature and unit tests
-
Explore Advanced Topics
- Queues and jobs
- Events and listeners
- API development with Laravel Sanctum
- Real-time features with Laravel Echo
-
Contribute Back
- Improve this template
- Help others in the community
- Share your learning journey
Good luck with your Laravel learning journey! 🚀