delete backend, starting over
This commit is contained in:
parent
babf9eb855
commit
f6a33cf620
51 changed files with 0 additions and 6655 deletions
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Database;
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
abstract class Migration
|
||||
{
|
||||
abstract public function up(): void;
|
||||
|
||||
abstract public function down(): void;
|
||||
|
||||
protected function schema(): Builder
|
||||
{
|
||||
return Capsule::schema();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Database;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class SessionModel extends Model
|
||||
{
|
||||
protected $table = 'sessions';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $primaryKey = 'token';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'token',
|
||||
'user_id',
|
||||
'expires_at',
|
||||
'created_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'expires_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(UserModel::class, 'user_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Database;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserModel extends Model
|
||||
{
|
||||
protected $table = 'users';
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'email',
|
||||
'password_hash',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id' => 'int',
|
||||
];
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use App\Database\Migration;
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Capsule::schema()->create('users', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->string('email', 255)->unique();
|
||||
$table->string('password_hash', 255);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Capsule::schema()->dropIfExists('users');
|
||||
}
|
||||
}
|
||||
|
||||
return CreateUsersTable::class;
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use App\Database\Migration;
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
class CreateSessionsTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Capsule::schema()->create('sessions', function ($table) {
|
||||
$table->string('token')->primary();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->foreign('user_id')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->cascadeOnDelete();
|
||||
$table->dateTime('expires_at');
|
||||
$table->dateTime('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Capsule::schema()->dropIfExists('sessions');
|
||||
}
|
||||
}
|
||||
|
||||
return CreateSessionsTable::class;
|
||||
Loading…
Add table
Add a link
Reference in a new issue