A simple Laravel-based Blog Application with:
- Public blog posts
- User registration & login (session-based)
- User post & comment management
- Admin dashboard to manage users, posts, and comments
This project is built without Laravel default auth, using custom session-based authentication, ideal for learning core Laravel concepts.
- User Registration with profile image
- User Login / Logout (Session-based)
- Create, Edit, Delete Posts
- View All Posts with Pagination
- Add, Edit, Delete Comments
- View User Profile
- Admin Login / Logout
- Admin Dashboard with statistics
- View & Delete Users
- View & Delete Posts
- View & Delete Comments
- Admin Authentication Middleware
- Laravel
- Blade Templates
- MySQL
- Bootstrap 5
- Session-based Authentication
- Eloquent ORM
resources/
├── views/
│ ├── admin/
│ │ ├── auth/
│ │ │ └── login.blade.php
│ │ ├── comments/
│ │ │ └── index.blade.php
│ │ ├── posts/
│ │ │ └── index.blade.php
│ │ ├── users/
│ │ │ └── index.blade.php
│ │ ├── layouts/
│ │ │ └── app.blade.php
│ │ └── dashboard.blade.php
│ ├── post/
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── show.blade.php
│ ├── postuser/
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ ├── index.blade.php
│ │ ├── login.blade.php
│ │ └── show.blade.php
│ ├── layouts/
│ │ └── app.blade.php
│
- AdminAuthController
- DashboardController
- AdminPostController
- AdminUserController
- AdminCommentController
- PostUserController
- PostController
- CommentController
- Custom session-based authentication
- Session key:
user
- Separate
adminstable - Session key:
admin - Protected using
AdminAuthmiddleware
Location:
app/Http/Middleware/AdminAuth.php
Purpose:
- Restricts access to admin routes
- Allows access only to logged-in admins
adminspost_userspostscomments
- PostUser → hasMany Posts
- PostUser → hasMany Comments
- Post → belongsTo PostUser
- Post → hasMany Comments
- Comment → belongsTo Post
- Comment → belongsTo PostUser
- Profile Images:
public/uploads/profile/ - Post Images:
public/uploads/posts/
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate
php artisan serveInsert an admin record manually into the database:
INSERT INTO admins (name, email, password)
VALUES ('Admin', 'admin@example.com', '1234');
This project is for learning purposes only.
- Passwords are stored in plain text
- Session-based authentication only
- Not recommended for production use
- Use password hashing (
bcrypt) - Use Laravel’s built-in authentication system
- Implement CSRF protection and authorization policies
By working on this project, you will learn:
- Laravel MVC Architecture
- Custom Authentication using Sessions
- Middleware Creation and Usage
- Eloquent ORM & Model Relationships
- File Upload Handling
- Pagination and Form Validation
- Admin Dashboard Logic
This project is intended for educational use.
Feel free to fork, improve, or extend it for practice.
This project is open-source and available for learning and personal use.