Add ShitUser table

This commit is contained in:
2021-09-11 16:02:23 +02:00
parent 38780c8484
commit 78aa58f3db
3 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ShitController extends Controller
{
public function increment() {
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ShitUser extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'id',
'user_id',
'description',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array
*/
protected $hidden = [
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
];
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ShitUser extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('shituser', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->unsigned();
$table->index('user_id');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->string('description');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$table->dropForeign('lists_user_id_foreign');
$table->dropIndex('lists_user_id_index');
$table->dropColumn('user_id');
$table->dropTable('shituser');
}
}