Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix authored Mar 13, 2024
1 parent 806018a commit 68ee27f
Show file tree
Hide file tree
Showing 34 changed files with 188 additions and 107 deletions.
3 changes: 2 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'single_line' => true,
'single_line' => false,
],
'clean_namespace' => true,
'compact_nullable_typehint' => true,
Expand Down Expand Up @@ -220,6 +220,7 @@
__DIR__.'/tests/Unit',
])
->name('*.php')
->name('*.phps')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ public function up(): void
$table->bigInteger('rank')->default(0);
$table->bigInteger('size')->default(0);

// Matrix

$table->string('matrix')->default('');
$table->bigInteger('x')->nullable();
$table->bigInteger('y')->nullable();
$table->bigInteger('z')->nullable();
$table->decimal('r', 65, 10)->nullable()->default(null);
$table->decimal('theta', 10, 6)->nullable()->default(null);
$table->decimal('rho', 10, 6)->nullable()->default(null);
$table->decimal('phi', 10, 6)->nullable()->default(null);
$table->decimal('elevation', 65, 10)->nullable()->default(null);
$table->decimal('latitude', 8, 6)->nullable()->default(null);
$table->decimal('longitude', 9, 6)->nullable()->default(null);

// Flags

$table->boolean('active')->default(1)->index();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Concerns;

/**
* \Playground\Models\Traits\Abilities
* \Playground\Models\Concerns\Abilities
*/
trait Abilities
{
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Traits/Admin.php → src/Models/Concerns/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Concerns;

/**
* \Playground\Models\Traits\Admin
* \Playground\Models\Concerns\Admin
*/
trait Admin
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Concerns;

/**
* \Playground\Models\Traits\Privileges
* \Playground\Models\Concerns\Privileges
*/
trait Privileges
{
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Traits/Role.php → src/Models/Concerns/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Concerns;

/**
* \Playground\Models\Traits\Role
* \Playground\Models\Concerns\Role
*
* @property string $role
* @property array<int, string> $roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Concerns;

use Illuminate\Database\Eloquent\Relations\HasMany;

/**
* \Playground\Models\Traits\WithChildren
* \Playground\Models\Concerns\WithChildren
*/
trait WithChildren
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Concerns;

use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* \Playground\Models\Traits\WithCreator
* \Playground\Models\Concerns\WithCreator
*/
trait WithCreator
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Concerns;

use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* \Playground\Models\Traits\WithModifier
* \Playground\Models\Concerns\WithModifier
*/
trait WithModifier
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Concerns;

use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* \Playground\Models\Traits\WithOwner
* \Playground\Models\Concerns\WithOwner
*/
trait WithOwner
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Concerns;

use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* \Playground\Models\Traits\WithParent
* \Playground\Models\Concerns\WithParent
*/
trait WithParent
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* Playground
*/
namespace Playground\Models\Interfaces;
namespace Playground\Models\Contracts;

use Illuminate\Database\Eloquent\Relations\HasMany;

/**
* \Playground\Models\Interfaces\WithRevisionInterface
* \Playground\Models\Contracts\WithRevisionInterface
*/
interface WithRevisionInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/**
* Playground
*/
namespace Playground\Models\Interfaces;
namespace Playground\Models\Contracts;

use Illuminate\Database\Eloquent\Relations\HasMany;

/**
* \Playground\Models\Interfaces\WithChildrenInterface
* \Playground\Models\Contracts\WithChildren
*/
interface WithChildrenInterface
interface WithChildren
{
/**
* Get the children under the model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/**
* Playground
*/
namespace Playground\Models\Interfaces;
namespace Playground\Models\Contracts;

use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* \Playground\Models\Interfaces\WithCreatorInterface
* \Playground\Models\Contracts\WithCreator
*/
interface WithCreatorInterface
interface WithCreator
{
/**
* Get the creator of the model.
Expand Down
24 changes: 24 additions & 0 deletions src/Models/Contracts/WithMatrix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Playground
*/
namespace Playground\Models\Contracts;

/**
* \Playground\Models\Contracts\WithMatrix
*
* @property string $matrix
* @property ?int $x
* @property ?int $y
* @property ?int $z
* @property ?double $r
* @property ?double $theta
* @property ?double $rho
* @property ?double $phi
* @property ?double $elevation
* @property ?double $latitude
* @property ?double $longitude
*/
interface WithMatrix
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/**
* Playground
*/
namespace Playground\Models\Interfaces;
namespace Playground\Models\Contracts;

use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* \Playground\Models\Interfaces\WithModifierInterface
* \Playground\Models\Contracts\WithModifier
*/
interface WithModifierInterface
interface WithModifier
{
/**
* Get the modifier of the model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/**
* Playground
*/
namespace Playground\Models\Interfaces;
namespace Playground\Models\Contracts;

use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* \Playground\Models\Interfaces\WithOwnerInterface
* \Playground\Models\Contracts\WithOwner
*/
interface WithOwnerInterface
interface WithOwner
{
/**
* Get the owner of the model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/**
* Playground
*/
namespace Playground\Models\Interfaces;
namespace Playground\Models\Contracts;

use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* \Playground\Models\Interfaces\WithParentInterface
* \Playground\Models\Contracts\WithParent
*/
interface WithParentInterface
interface WithParent
{
/**
* Get the parent of the model.
Expand Down
46 changes: 29 additions & 17 deletions src/Models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Carbon;
use Playground\Models\Interfaces\WithChildrenInterface;
use Playground\Models\Interfaces\WithCreatorInterface;
use Playground\Models\Interfaces\WithModifierInterface;
use Playground\Models\Interfaces\WithOwnerInterface;
use Playground\Models\Interfaces\WithParentInterface;

/**
* \Playground\Models\Model
Expand All @@ -30,22 +25,39 @@
* @property string $created_by_id
* @property string $modified_by_id
* @property string $owned_by_id
* @property string $matrix
* @property ?double $r
* @property ?double $θ
* @property ?double $ρ
* @property ?double $φ
* @property ?double $elevation
* @property ?double $latitude
* @property ?double $longitude
* @property ?int $x
* @property ?int $y
* @property ?int $z
*/
abstract class Model extends UuidModel implements WithChildrenInterface, WithCreatorInterface, WithModifierInterface, WithOwnerInterface, WithParentInterface
abstract class Model extends UuidModel implements
Contracts\WithChildren,
Contracts\WithCreator,
Contracts\WithMatrix,
Contracts\WithModifier,
Contracts\WithOwner,
Contracts\WithParent
{
use Concerns\WithChildren;
use Concerns\WithCreator;
use Concerns\WithModifier;
use Concerns\WithOwner;
use Concerns\WithParent;
use HasFactory;
use Scopes\ScopeFilterColumns;
use Scopes\ScopeFilterDates;
use Scopes\ScopeFilterFlags;
use Scopes\ScopeFilterIds;
use Scopes\ScopeFilterTrash;
use Scopes\ScopeSort;
use SoftDeletes;
use Traits\ScopeFilterColumns;
use Traits\ScopeFilterDates;
use Traits\ScopeFilterFlags;
use Traits\ScopeFilterIds;
use Traits\ScopeFilterTrash;
use Traits\ScopeSort;
use Traits\WithChildren;
use Traits\WithCreator;
use Traits\WithModifier;
use Traits\WithOwner;
use Traits\WithParent;

protected $perPage = 15;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Scopes;

use Illuminate\Database\Eloquent\Builder;

// use Illuminate\Support\Facades\Log;

/**
* \Playground\Models\Traits\ScopeFilterColumns
* \Playground\Models\Scopes\ScopeFilterColumns
*/
trait ScopeFilterColumns
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
/**
* Playground
*/
namespace Playground\Models\Traits;
namespace Playground\Models\Scopes;

use Carbon\Exceptions\InvalidFormatException;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log;

/**
* \Playground\Models\Traits\scopeFilterDates
* \Playground\Models\Scopes\scopeFilterDates
*/
trait ScopeFilterDates
{
Expand Down
Loading

0 comments on commit 68ee27f

Please sign in to comment.