Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
feat: add user model (#1)
Browse files Browse the repository at this point in the history
- add basic multilingual support
- add Looseleaf CSS and barebones layouts
- improve boilerplate CSS (fix #9)
  • Loading branch information
greatislander authored Jul 15, 2021
1 parent a1ccaec commit 86a5665
Show file tree
Hide file tree
Showing 113 changed files with 3,244 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
commit_message: "fix: apply code styling rules"
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [7.4, 8.0]
php: [8.0]
laravel: [8.*]
stability: [prefer-lowest, prefer-stable]
include:
Expand Down
1 change: 1 addition & 0 deletions .php_cs.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
$finder = Symfony\Component\Finder\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/stubs',
__DIR__ . '/tests',
])
->name('*.php')
Expand Down
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,38 @@ Hearth is a simple starter kit for the Laravel framework. It provides a few thin

## Installation

You can install the package via composer:
You may use Composer to install Hearth into your new Laravel project:

```bash
composer require fluid-project/hearth
```

After installing the Hearth package, you can use the `hearth:install` command to
_Note: attempting to install Hearth into an existing Laravel application will result in unexpected behaviour._

After installing the Hearth package, you can use the `hearth:install` Artisan command to
install the Hearth scaffolding within your Laravel application:

```bash
php artisan hearth:install
```

After installing Hearth, you will need to install and build your NPM dependencies
and run your database migrations:
After installing Hearth, you will need to install and build your NPM dependencies, run your database migrations and link
public storage:

```bash
npm install
npm run dev
php artisan migrate
php artisan storage:link
```

### Emails

In order to test emails (for example, using Mailhog with [Laravel Sail](https://laravel.com/docs/8.x/sail#previewing-emails)),
you must update your Laravel application's `.env` file's `MAIL_FROM_ADDRESS` environment variable with a
properly-formatted email address. For local development, this might be `[email protected]` (assuming your local
application is accessible at `http://hearth.test`).

## Usage

TODO.
Expand Down Expand Up @@ -73,3 +83,13 @@ Please review [our security policy](../../security/policy) on how to report secu
## License

The BSD 3-Clause License. Please see [License File](LICENSE.md) for more information.

## Third Party Software in Hearth

Hearth is based on other publicly available software, categorized by license:

### MIT License

- [Laravel Breeze](https://github.com/laravel/breeze)
- [Laravel Jetstream](https://github.com/laravel/jetstream)
- [Laravel Package Skeleton](https://github.com/spatie/package-skeleton-laravel)
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
}
],
"require": {
"php": "^7.4|^8.0",
"php": "^8.0",
"chinleung/laravel-locales": "^1.2",
"chinleung/laravel-multilingual-routes": "^2.7",
"commerceguys/intl": "^1.1",
"illuminate/contracts": "^8.37",
"laravel/fortify": "^1.7",
"spatie/laravel-package-tools": "^1.4.3"
"spatie/laravel-flash": "^1.8",
"spatie/laravel-google-fonts": "^1.0",
"spatie/laravel-package-tools": "^1.9",
"spatie/laravel-sluggable": "^3.1"
},
"require-dev": {
"brianium/paratest": "^6.2",
Expand Down
3 changes: 2 additions & 1 deletion config/hearth.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
// config for InclusiveDesign/ClassName

// config for Hearth/Hearth
return [

];
19 changes: 0 additions & 19 deletions database/factories/ModelFactory.php

This file was deleted.

36 changes: 36 additions & 0 deletions database/factories/UserFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Database\Factories;

use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$name = $this->faker->name;
return [
'name' => $name,
'slug' => Str::slug($name),
'email' => $this->faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
'locale' => 'en',
];
}
}
19 changes: 0 additions & 19 deletions database/migrations/create_hearth_table.php.stub

This file was deleted.

38 changes: 38 additions & 0 deletions database/migrations/create_users_table.php.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('locale')->default('en');
$table->rememberToken();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
verbose="true"
>
<testsuites>
<testsuite name="InclusiveDesign Test Suite">
<testsuite name="Hearth Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
8 changes: 8 additions & 0 deletions resources/lang/en/alert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'error' => 'Error',
'warning' => 'Warning',
'success' => 'Success',
'notice' => 'Notice'
];
42 changes: 42 additions & 0 deletions resources/lang/en/auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/

'sign_in' => 'Sign in',
'sign_out' => 'Sign out',
'create_account' => 'Create an account',
'label_password' => 'Password',
'label_password_confirmation' => 'Confirm password',
'existing_account_prompt' => 'Do you already have an account?',
'create_your_account' => 'Create your account',
'label_current_password' => 'Current password',
'change_password' => 'Change password',
'action_confirm' => 'Confirm',
'password_change_succeeded' => 'Your password has been changed.',
'label_remember_me' => 'Remember me',
'error_intro' => 'Sorry, something went wrong.',
'failed' => 'These credentials do not match our records.',
'wrong_password' => 'The provided password is incorrect.',
'throttle' => 'Too many log in attempts. Please try again in :seconds seconds.',
'confirm_intro' => 'For your security, please confirm your password before continuing.',
'forget_prompt' => 'Forgot your password?',
'forgot_intro' => 'Forgot your password? Enter your email address and we will email you a password reset link that will let you choose a new one.',
'forgot_submit' => 'Send password reset link',
'reset_submit' => 'Reset password',
'verification_required' => 'Email verification required',
'verification_intro' => 'Please verify your email address by clicking on the link we emailed to you. If you didn’t receive the email, we will gladly send you another.',
'verification_sent' => 'A new verification link has been sent to the email address you provided.',
'resend_verification_email' => 'Resend verification email',
'verification_succeeded' => 'Your email address has been verified.'
];
6 changes: 6 additions & 0 deletions resources/lang/en/dashboard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return [
'title' => 'Dashboard',
'welcome' => 'Welcome, :name!'
];
31 changes: 31 additions & 0 deletions resources/lang/en/errors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Errors Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used for HTTP error messages that we need
| to display to the user. You are free to modify these language lines
| according to your application's requirements.
|
*/

'error_401_title' => 'Not authorized',
'error_401_message' => 'You are not authorized to visit this page. You may need to log in.',
'error_403_title' => 'Access forbidden',
'error_403_message' => 'You do not have permission to visit this page.',
'error_404_title' => 'Not found',
'error_404_message' => 'The page you are trying to visit could not be found.',
'error_419_title' => 'Page expired',
'error_419_message' => 'The page has expired. Please try again.',
'error_429_title' => 'Too many requests',
'error_429_message' => 'You have sent too many requests to this page. Please wait a few moments and try again.',
'error_500_title' => 'Server error',
'error_500_message' => 'Sorry, it looks like something isn’t working properly on our end.',
'error_503_title' => 'Service unavailable',
'error_503_message' => 'Sorry, it looks like the website can’t respond to your request right now. Please wait a few moments and try again.',
'return_home' => 'Return to home page',
];
8 changes: 8 additions & 0 deletions resources/lang/en/forms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'save_changes' => 'Save changes',
'label_email' => 'Email address',
'errors_found' => 'Errors found',
'errors_found_message' => 'Sorry, some errors were found in your submission. Please correct these errors and try again.'
];
8 changes: 8 additions & 0 deletions resources/lang/en/mail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'error' => 'Sorry!',
'greeting' => 'Hello!',
'salutation' => 'Regards',
'link_guidance' => 'If you’re having trouble clicking the ":actionText" button, copy and paste the URL below into your web browser:'
];
22 changes: 22 additions & 0 deletions resources/lang/en/passwords.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/

'reset' => 'Your password has been reset!',
'sent' => 'We have emailed your password reset link!',
'throttled' => 'Please wait before retrying.',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that email address.",

];
9 changes: 9 additions & 0 deletions resources/lang/en/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

return [
'dashboard' => 'dashboard',
'logout' => 'logout',
'login' => 'login',
'register' => 'register',
'verification.verify' => '/verify-email/{id}/{hash}'
];
13 changes: 13 additions & 0 deletions resources/lang/en/user.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
'settings' => 'Settings',
'account' => 'Account',
'label_name' => 'Full name',
'label_locale' => 'Preferred language',
'delete_account' => 'Delete account',
'delete_account_intro' => 'Your account will be deleted and cannot be recovered. If you still want to delete your account, please enter your current password to proceed.',
'action_delete_account' => 'Delete my account',
'settings_update_succeeded' => 'Your settings have been saved.',
'destroy_succeeded' => 'Your account has been deleted.',
];
Loading

0 comments on commit 86a5665

Please sign in to comment.