Step 1: Create a New Laravel Project
Open your terminal and run:
composer create-project --prefer-dist laravel/laravel Laravel-app "10.*"
Step 2: Configure the Database
Open the .env file in the root of your project.
Update the database connection settings to match your requirements:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=Name_your_db
DB_USERNAME=root
DB_PASSWORD=
Step 3: Install Filament
Navigate to your project directory:
cd Laravel-app
Install Filament using Composer:
composer require filament/filament
Step 4: Publish Filament Assets
After installing Filament, publish its assets:
php artisan vendor:publish --tag=filament-views
Step 5: Create the Admin User
You can create a new admin user by running the following command:
php artisan make:filament-user
Enter the required details when prompted to enter details like name, email, and password for the admin user.
Step 6: Set Up the Filament Routes (Optional)
Filament automatically configures the routes, but you can customize them in routes/web.php if needed.
Step 7: Run the Migrations
Run migrations to set up the database tables:
php artisan migrate
Step 8: Start Your Local Development Server
Finally, you can start your local development server:
php artisan serve
Now, you should be able to access the Filament admin panel at http://localhost:8000/admin.
Step 9: Login
Use the admin credentials you created earlier to log in.
This version is a bit more polished while retaining all the necessary information. Let me know if you want to add or change anything!
Additional Steps for Admin User Issues
If you encounter problems logging in with the admin user, follow these steps:
- Creating the Admin User with Proper Hashing
If you need to ensure the password is hashed correctly, use Laravel Tinker:
php artisan tinker
Then, create the admin user:
use App\Models\User;
use Illuminate\Support\Facades\Hash;
User::create([
'name' => 'Admin User',
'email' => 'admin@example.com',
'password' => Hash::make('your_password'), // Replace 'your_password' with your chosen password
'is_admin' => true, // If you have an 'is_admin' column
]);
Exit Tinker by typing exit.
Verifying the User in the Database
Confirm that the user was created and the password is hashed:
SELECT * FROM users WHERE email = 'admin@example.com';
The hashed password should appear similar to:
$2y$10$e2N.hW6UXW8gkTlkM3XgkuD/ICQ4tfz8m8WSzHyeG3I0Bds4pV5Xq
Attempt to Log In
Use the email admin@example.com and the password you set.
Troubleshooting
Double-check for typos in the email or password.
Clear the application cache:
php artisan config:cache
php artisan route:cache
Review logs for authentication errors in storage/logs/laravel.log.
If these steps don’t resolve the issue, feel free to ask for further help!
This version streamlines your original instructions while retaining all the necessary steps and troubleshooting tips. Let me know if you’d like any further refinements!