Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

DEBUGBAR_ENABLED=true

DEFAULT_USER_EMAIL="admin@example.com"
DEFAULT_USER_PASSWORD="password"
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Kickstart your project and save time with Larament! This time-saving starter kit

- The Filament Panel's primary color is set to blue.
- Single Page Application (SPA) mode is enabled by default, providing faster and smoother user experiences.
- A custom login page auto-fills email and password with seeded data, removing the need for manual typing in local testing.
- A custom login page autofills email and password with seeded data, removing the need for manual typing in local testing.
- Global search keybinding is preset to `CTRL + K` or `CMD + K` (for macOS) for quick access to search functionality.
- A PEST test case for the `UserResource` ensures all functionalities are tested effectively.
- The global user search includes email addresses in the search results for better user discovery.
Expand All @@ -27,6 +27,14 @@ Kickstart your project and save time with Larament! This time-saving starter kit
- All component labels are automatically translatable, so there’s no need to add `->translateLabel()` to individual components.
- Archtest is included for architectural testing.

## Default User (Local)
By default, the first user will be created based on the credentials setup in the `.env` file. If you want to change the default user after running the seeders, you can update the `DEFAULT_USER_EMAIL` and `DEFAULT_USER_PASSWORD` in the `.env` file and run the seeders again.

```dotenv
DEFAULT_USER_EMAIL="admin@example.com"
DEFAULT_USER_PASSWORD="password"
```

## [Helpers](https://laravel-news.com/creating-helpers)
I've set up a Helper file for you to use in your Laravel app. You can find it at `app\Helpers.php`. This file is ready for you to add your custom helper functions, which Composer will automatically include in your project.

Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Pages/Auth/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public function mount(): void

if (app()->isLocal()) {
$this->form->fill([
'email' => 'admin@example.com',
'password' => 'password',
'email' => config('app.default_user.email'),
'password' => config('app.default_user.password'),
'remember' => true,
]);
}
Expand Down
9 changes: 9 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,13 @@
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],

/*
* Default user credentials for local development environment
* This will be used as the default user credentials when seeding the database
*/

'default_user' => [
'email' => env('DEFAULT_USER_EMAIL'),
'password' => env('DEFAULT_USER_PASSWORD'),
],
];
4 changes: 3 additions & 1 deletion database/seeders/UserSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class UserSeeder extends Seeder
{
public function run(): void
{
User::factory()
->create([
'email' => 'admin@example.com',
'email' => config('app.default_user.email'),
'password' => Hash::make(config('app.default_user.password')),
'name' => 'Admin',
]);
}
Expand Down