A Laravel 5.8 starter kit designed to provide a solid foundation for new web applications. It comes pre-configured with user authentication, an AdminLTE 2 backend theme, role-based access control, and more.
- Built on Laravel 5.8 framework.
- AdminLTE 2 for a responsive and feature-rich backend interface.
- User management (Create, Read, Update, Delete users).
- Role-based access control (pre-configured 'admin' and 'user' roles, managed via
role_id
on theusers
table). - Data presentation with
leantony/laravel-grid
. - Backend log viewer for easier debugging.
- Includes example pages and dashboard.
- PHP >= 7.1.3
- Composer
- NPM (Node Package Manager) or Yarn for frontend asset management.
- A database server (e.g., MySQL, PostgreSQL, SQLite).
- Clone the repository:
git clone https://github.com/your-username/laravel-base-start.git # Replace with your actual repository URL
- Navigate into the project directory:
cd laravel-base-start
- Install PHP dependencies:
composer install
- Create your environment file:
cp .env.example .env
- Generate an application key:
php artisan key:generate
- Configure your database credentials (DB_DATABASE, DB_USERNAME, DB_PASSWORD, etc.) and mail driver settings in the
.env
file. - Run database migrations:
php artisan migrate
- Note: The base project does not include a seeder for default users. You will need to create users manually after installation (see Usage section).
- Install frontend dependencies:
npm install
(oryarn install
) - Compile frontend assets:
- For development:
npm run dev
(oryarn dev
) - For production:
npm run prod
(oryarn prod
)
- For development:
- Start the development server:
php artisan serve
- The application should now be accessible at
http://localhost:8000
by default.
-
Access the application by navigating to
http://localhost:8000
(or the URL provided byphp artisan serve
). -
Creating an Admin User: Since no default admin user is seeded, you'll need to create one:
- Register a new user: Use the application's registration form (
/register
) to create a new user account. - Assign Admin Role:
- Connect to your application using Tinker:
php artisan tinker
- Find the user you just created (e.g., by email):
$user = App\Models\User::where('email', '[email protected]')->first();
- Set their
role_id
to1
. This ID is commonly used for the 'admin' role in such setups:$user->role_id = 1; $user->save();
- Exit Tinker:
exit
- Connect to your application using Tinker:
- Log out and log back in with this user. You should now have admin privileges.
- (Note: This guide assumes
role_id = 1
corresponds to the 'admin' role, a common convention. Theapp/Http/Middleware/Role.php
attempts to useisAdmin()
andhasRole()
methods on the User model, which are not currently defined inapp/Models/User.php
. Settingrole_id
directly is the current workaround for assigning roles.)
- Register a new user: Use the application's registration form (
-
Admin Panel: Once logged in with an admin user, the admin area and features should be accessible (typically via a dashboard link).
-
Explore the user management features and other functionalities available in the dashboard.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name
). - Make your changes.
- Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature-name
). - Create a new Pull Request.
This project is open-sourced software licensed under the MIT license.