Skip to content

Commit

Permalink
#11 apis v2 model
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Sep 6, 2024
1 parent ab7e162 commit 7451d5f
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public function up()
$table->string('v4')->nullable();
$table->string('v5')->nullable();
$table->timestamps();

$table->comment('casbin rule table');

});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public function up()
$table->unsignedTinyInteger('type')->default(0);
$table->unsignedTinyInteger('status')->default(1);
$table->timestamps();


$table->comment('permission table');
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public function up()
$table->string('desc')->nullable();
$table->unsignedTinyInteger('status')->default(1);
$table->timestamps();

$table->comment('role table');
});
}

Expand Down
35 changes: 35 additions & 0 deletions src/Models/Admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace NexaMerchant\Apis\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;

class Admin extends Authenticatable implements JWTSubject
{
use HasFactory;

public $incrementing = false;


protected $hidden = [
'password',
];

public function getJWTIdentifier()
{
return $this->getKey();
}

public function getJWTCustomClaims()
{
return [];
}

protected $casts = [
'id' => 'string',
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
}
18 changes: 18 additions & 0 deletions src/Models/Permission.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace NexaMerchant\Apis\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Kalnoy\Nestedset\NodeTrait;

class Permission extends Model
{
use HasFactory, NodeTrait;

protected $casts = [
'id' => 'string',
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
}
18 changes: 18 additions & 0 deletions src/Models/Role.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace NexaMerchant\Apis\Models;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
use HasFactory;

protected $casts = [
'id' => 'string',
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
}

0 comments on commit 7451d5f

Please sign in to comment.