Compare commits
9 Commits
3f340d57fc
...
87cd634613
Author | SHA1 | Date | |
---|---|---|---|
87cd634613 | |||
48a34d5acf | |||
05ca3574b0 | |||
739c2b79e9 | |||
6e7ded098b | |||
64d4d326b7 | |||
fdba9f1ae7 | |||
27032f433a | |||
0c8a6c410d |
@ -27,6 +27,6 @@ modified="git diff --diff-filter=M --name-only --cached | grep \".php$\""
|
|||||||
ignore="resources/lang,resources/views,bootstrap/helpers,database/migrations,bin"
|
ignore="resources/lang,resources/views,bootstrap/helpers,database/migrations,bin"
|
||||||
phpcs="vendor/bin/phpcs --report=code --colors --report-width=80 --ignore=${ignore}"
|
phpcs="vendor/bin/phpcs --report=code --colors --report-width=80 --ignore=${ignore}"
|
||||||
|
|
||||||
__run "1/1" "code sniffer" "${modified} | xargs -r ${phpcs}"
|
__run "1/2" "php lint" "${modified} | xargs -r php -l"
|
||||||
# __run "2/3" "php lint" "${modified} | xargs -r php -l"
|
__run "2/2" "code sniffer" "${modified} | xargs -r ${phpcs}"
|
||||||
# __run "3/3" "phpstan" "${modified} | xargs -r vendor/bin/phpstan analyse"
|
# __run "3/3" "phpstan" "${modified} | xargs -r vendor/bin/phpstan analyse"
|
||||||
|
@ -52,7 +52,7 @@ class CreateUser extends Command
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$this->info("$email created successfully.");
|
$this->info("$email created successfully.");
|
||||||
return 0;
|
return Command::SUCCESS;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error('Unable to create your user.');
|
$this->error('Unable to create your user.');
|
||||||
$this->line($e->getMessage());
|
$this->line($e->getMessage());
|
||||||
|
@ -52,7 +52,7 @@ class ResetPassword extends Command
|
|||||||
$column = 'email';
|
$column = 'email';
|
||||||
$value = $email;
|
$value = $email;
|
||||||
} else {
|
} else {
|
||||||
$column = strtolower($this->choice('What column would you like to search by?', ['ID', 'Email']));
|
$column = strtolower($this->choice('What database column would you like to search by?', ['ID', 'Email']));
|
||||||
$value = $this->ask("Please provide an $column to search for");
|
$value = $this->ask("Please provide an $column to search for");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class ResetPassword extends Command
|
|||||||
try {
|
try {
|
||||||
$user->update(['password' => Hash::make($password)]);
|
$user->update(['password' => Hash::make($password)]);
|
||||||
$this->info("User {$user->id} ({$user->email}) password update successful!");
|
$this->info("User {$user->id} ({$user->email}) password update successful!");
|
||||||
return 0;
|
return Command::SUCCESS;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error('Unable to set the password!');
|
$this->error('Unable to set the password!');
|
||||||
$this->line($e->getMessage());
|
$this->line($e->getMessage());
|
||||||
|
@ -42,18 +42,18 @@ class HandleInertiaRequests extends Middleware
|
|||||||
*/
|
*/
|
||||||
public function share(Request $request): array
|
public function share(Request $request): array
|
||||||
{
|
{
|
||||||
$localeFields = ['locale', 'iso_code', 'name', 'localized_name'];
|
$localeFields = ['locale_name', 'iso_code', 'name', 'localized_name'];
|
||||||
$currentLocale = $request->session()->get('locale', null);
|
$currentLocale = $request->session()->get('locale', null);
|
||||||
if (is_null($currentLocale)) {
|
if (is_null($currentLocale)) {
|
||||||
$currentLocale = Language::where(['locale' => 'en', 'iso_code' => 'en_US'])->get($localeFields)[0]->toArray();
|
$currentLocale = Language::where(['locale_name' => 'en', 'iso_code' => 'en_US'])->get($localeFields)[0]->toArray();
|
||||||
$request->session()->put('locale', [
|
$request->session()->put('locale', [
|
||||||
'locale' => $currentLocale['locale'],
|
'locale_name' => $currentLocale['locale_name'],
|
||||||
'iso_code' => $currentLocale['iso_code'],
|
'iso_code' => $currentLocale['iso_code'],
|
||||||
'name' => $currentLocale['name'],
|
'name' => $currentLocale['name'],
|
||||||
'localized_name' => $currentLocale['localized_name'],
|
'localized_name' => $currentLocale['localized_name'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$localeFilePath = base_path("lang/{$currentLocale['locale']}.json");
|
$localeFilePath = base_path("lang/{$currentLocale['locale_name']}.json");
|
||||||
|
|
||||||
$notifications = [];
|
$notifications = [];
|
||||||
$notificationsCount = count($notifications);
|
$notificationsCount = count($notifications);
|
||||||
|
51
src/app/Models/Casts/MoneyCastable.php
Normal file
51
src/app/Models/Casts/MoneyCastable.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Casts;
|
||||||
|
|
||||||
|
use Brick\Money\Money;
|
||||||
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class MoneyCastable implements CastsAttributes
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the value from the database and modify it to casted type
|
||||||
|
* before returning.
|
||||||
|
*
|
||||||
|
* @package App\Models\Casts\MoneyCastable
|
||||||
|
* @since 1.0.0
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Model $model The Model that is being used
|
||||||
|
* @param string $key The attribute key
|
||||||
|
* @param mixed $value The value stored in the database
|
||||||
|
* @param array $attributes The array of model attributes
|
||||||
|
*
|
||||||
|
* @return \Brick\Money\Money
|
||||||
|
*/
|
||||||
|
public function get(Model $model, string $key, $value, array $attributes): Money
|
||||||
|
{
|
||||||
|
return Money::ofMinor($attributes['amount'], $attributes['currency']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store the data .
|
||||||
|
*
|
||||||
|
* @package App\Models\Casts\MoneyCastable
|
||||||
|
* @since 1.0.0
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Model $model The Model that is being used
|
||||||
|
* @param string $key The attribute key
|
||||||
|
* @param mixed $value The value stored in the database
|
||||||
|
* @param array $attributes The array of model attributes
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function set(Model $model, string $key, $value, array $attributes)
|
||||||
|
{
|
||||||
|
if (! $value instanceof Money) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value->getMinorAmount()->toInt();
|
||||||
|
}
|
||||||
|
}
|
@ -7,18 +7,20 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Prunable;
|
use Illuminate\Database\Eloquent\Prunable;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class Language extends Model
|
class Language extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
use Prunable;
|
use Prunable;
|
||||||
|
use SoftDeletes;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $table = 'languages';
|
protected $table = 'languages';
|
||||||
|
|
||||||
/** @var array<int,string> */
|
/** @var array<int,string> */
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'locale',
|
'locale_name',
|
||||||
'iso_code',
|
'iso_code',
|
||||||
'name',
|
'name',
|
||||||
'localized_name',
|
'localized_name',
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
"spatie/laravel-sitemap": "", // generate site maps
|
"spatie/laravel-sitemap": "", // generate site maps
|
||||||
"artesaos/seotools": "", // automatic SEO tools
|
"artesaos/seotools": "", // automatic SEO tools
|
||||||
"eumanito/php-capitalize-names": "", // Capitalize names with funky rules
|
"eumanito/php-capitalize-names": "", // Capitalize names with funky rules
|
||||||
|
"robinvdvleuten/ulid": "", // Universally Unique Lexicographically Sortable Identifier (ULID)
|
||||||
|
|
||||||
// Others/uncategorized
|
// Others/uncategorized
|
||||||
"appstract/laravel-opcache": "", // provides artisan commands to interact with opcache (not sure if site-specific)
|
"appstract/laravel-opcache": "", // provides artisan commands to interact with opcache (not sure if site-specific)
|
||||||
|
@ -32,7 +32,7 @@ class UserFactory extends Factory
|
|||||||
'email' => $this->faker->unique()->safeEmail(),
|
'email' => $this->faker->unique()->safeEmail(),
|
||||||
'email_verified_at' => now(),
|
'email_verified_at' => now(),
|
||||||
'timezone_name' => $this->faker->timezone(),
|
'timezone_name' => $this->faker->timezone(),
|
||||||
'timezone_name' => Language::all()->random()->id,
|
'language_id' => Language::all()->random()->id,
|
||||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||||
'remember_token' => Str::random(10),
|
'remember_token' => Str::random(10),
|
||||||
];
|
];
|
||||||
|
@ -15,7 +15,7 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('languages', function (Blueprint $table) {
|
Schema::create('languages', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('locale')->index();
|
$table->string('locale_name')->index();
|
||||||
$table->string('iso_code')->unique();
|
$table->string('iso_code')->unique();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('localized_name');
|
$table->string('localized_name');
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// phpcs:ignore
|
||||||
/**
|
/**
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Global String Functions
|
| Global String Functions
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This is a home for functions that don't belong to any one class and
|
| This is a home for functions that don't belong to any one class and
|
||||||
| that should be available anywhere in the application.
|
| that should be available anywhere in the application.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! function_exists('snake2Title')) {
|
if (! function_exists('snake2Title')) {
|
||||||
/**
|
/**
|
||||||
* Convert a snake case string to a title with spaces
|
* Convert a snake case string to a title with spaces
|
||||||
* and every word capitalized.
|
* and every word capitalized.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @param string $snakeSlug A snake case string, commonly a slug
|
||||||
*
|
*
|
||||||
* @param string $stakeSlug A snake case string, commonly a slug
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -34,11 +34,8 @@ body {
|
|||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
transition-duration: 0.05s;
|
transition-duration: 0.05s;
|
||||||
transition-timing-function: ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
html, body {
|
|
||||||
transition-property: background, color;
|
transition-property: background, color;
|
||||||
|
transition-timing-function: ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
button, a {
|
button, a {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.form-label {
|
.form-label {
|
||||||
@apply uppercase font-semibold text-xs text-zinc-600 dark:text-zinc-300;
|
@apply uppercase font-semibold text-xs text-zinc-600 dark:text-zinc-200;
|
||||||
}
|
}
|
||||||
|
|
||||||
input.form-input[type="date"],
|
input.form-input[type="date"],
|
||||||
@ -67,5 +67,5 @@ input.form-input[type="url"]:disabled,
|
|||||||
input.form-input[type="week"]:disabled,
|
input.form-input[type="week"]:disabled,
|
||||||
textarea.form-input:disabled,
|
textarea.form-input:disabled,
|
||||||
select.form-input:disabled {
|
select.form-input:disabled {
|
||||||
@apply bg-neutral-400 opacity-7;
|
@apply bg-neutral-400 opacity-75;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
// defines
|
||||||
defineProps({
|
defineProps({
|
||||||
message: String,
|
message: String,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user