Add ShitUser table
This commit is contained in:
14
shit-show/app/Http/Controllers/ShitController.php
Normal file
14
shit-show/app/Http/Controllers/ShitController.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ShitController extends Controller
|
||||
{
|
||||
|
||||
public function increment() {
|
||||
|
||||
}
|
||||
|
||||
}
|
39
shit-show/app/Models/ShitUser.php
Normal file
39
shit-show/app/Models/ShitUser.php
Normal 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 = [
|
||||
];
|
||||
}
|
@@ -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');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user