Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed Feb 19, 2024
1 parent 4a5546d commit f1f1d17
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 1,739 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
with:
level: 9
php_version: "8.2"
path: src/ tests/Unit/
path: config/ database/ resources/ src/ tests/Feature/ tests/Unit/
- name: Stopping timer
if: ${{ !cancelled() }}
id: timer_end
Expand Down
3 changes: 2 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@
__DIR__.'/database',
// __DIR__.'/lang',
// __DIR__.'/routes',
__DIR__.'/resources',
__DIR__.'/src',
// __DIR__.'/tests/Feature',
__DIR__.'/tests/Feature',
__DIR__.'/tests/Unit',
])
->name('*.php')
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Playground CI Workflow](https://github.com/gammamatrix/playground-test/actions/workflows/ci.yml/badge.svg?branch=develop)](https://raw.githubusercontent.com/gammamatrix/playground-test/testing/develop/testdox.txt)
[![Test Coverage](https://raw.githubusercontent.com/gammamatrix/playground-test/testing/develop/coverage.svg)](tests)
[![PHPStan Level 9 src and tests](https://img.shields.io/badge/PHPStan-level%209-brightgreen)](.github/workflows/ci.yml#L120)

The Playground Test package.

Expand Down
34 changes: 16 additions & 18 deletions resources/CustomUsersTableSeeder.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<?php
/**
* Playground
*
*/

namespace Database\Seeders;

use Playground\Test\Models\UserWithRoleAndPrivileges as User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Playground\Test\Models\UserWithRoleAndPrivileges as User;

/**
* \CustomUsersTableSeeder
Expand All @@ -27,21 +25,21 @@ public function run()
{
$config = config('playground-test');

if (!is_array($config) || empty($config['users']) || !is_array($config['users'])) {
if (! is_array($config) || empty($config['users']) || ! is_array($config['users'])) {
error_log('No users defined in playground-test.');

return;
}

$password = empty($config['password']) || ! is_string($config['password']) ? '' : $config['password'];
// $password = 'testing';
$password_encrypted = !empty($config['password_encrypted']);

$password_encrypted = ! empty($config['password_encrypted']);

if (empty($password) || !is_string($password)) {
if (empty($password) || ! is_string($password)) {
// Set a random password.
$password = md5(date('c'));
$password = Hash::make($password);
} elseif (!$password_encrypted) {
} elseif (! $password_encrypted) {
$password = Hash::make($password);
}

Expand All @@ -52,30 +50,30 @@ public function run()

if (empty($model)) {
$model = new User([
'name' => empty($meta['name']) || !is_string($meta['name']) ? 'Some Name' : $meta['name'],
'description' => empty($meta['description']) || !is_string($meta['description']) ? '' : $meta['description'],
'name' => empty($meta['name']) || ! is_string($meta['name']) ? 'Some Name' : $meta['name'],
'description' => empty($meta['description']) || ! is_string($meta['description']) ? '' : $meta['description'],
'active' => true,
'email' => $email,
'role' => empty($meta['role']) || !is_string($meta['role']) ? '' : $meta['role'],
'status' => empty($meta['status']) || !is_numeric($meta['status']) ? 0 : $meta['status'],
'role' => empty($meta['role']) || ! is_string($meta['role']) ? '' : $meta['role'],
'status' => empty($meta['status']) || ! is_numeric($meta['status']) ? 0 : $meta['status'],
]);
} else {
$model->update([
'name' => empty($meta['name']) || !is_string($meta['name']) ? 'Some Name' : $meta['name'],
'description' => empty($meta['description']) || !is_string($meta['description']) ? '' : $meta['description'],
'name' => empty($meta['name']) || ! is_string($meta['name']) ? 'Some Name' : $meta['name'],
'description' => empty($meta['description']) || ! is_string($meta['description']) ? '' : $meta['description'],
'active' => true,
'role' => empty($meta['role']) || !is_string($meta['role']) ? '' : $meta['role'],
'status' => empty($meta['status']) || !is_numeric($meta['status']) ? 0 : $meta['status'],
'role' => empty($meta['role']) || ! is_string($meta['role']) ? '' : $meta['role'],
'status' => empty($meta['status']) || ! is_numeric($meta['status']) ? 0 : $meta['status'],
]);
}

$roles = [];

if (is_array($meta['roles'])) {
foreach ($meta['roles'] as $role) {
if (!empty($role)
if (! empty($role)
&& is_string($role)
&& !in_array($role, $roles)
&& ! in_array($role, $roles)
&& $role !== $model->role
) {
$roles[] = $role;
Expand Down
2 changes: 1 addition & 1 deletion resources/DatabaseSeeder.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

namespace Database\Seeders;

// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
Expand Down
96 changes: 0 additions & 96 deletions src/Feature/Http/Controllers/Resource/CreateTrait.php

This file was deleted.

Loading

0 comments on commit f1f1d17

Please sign in to comment.