add label seeder
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Failing after 3m37s Details

This commit is contained in:
aslan 2024-04-27 15:06:00 +03:00
parent 1cb753ee6d
commit 45cc893f18
9 changed files with 296 additions and 0 deletions

View File

@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StorelabelRequest;
use App\Http\Requests\UpdatelabelRequest;
use App\Models\label;
class LabelController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(StorelabelRequest $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(label $label)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(label $label)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(UpdatelabelRequest $request, label $label)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(label $label)
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StorelabelRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdatelabelRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

11
app/Models/label.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class label extends Model
{
use HasFactory;
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\label;
use Illuminate\Auth\Access\Response;
class LabelPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, label $label): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, label $label): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, label $label): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, label $label): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, label $label): bool
{
//
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\label>
*/
class LabelFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('labels', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('labels');
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('label_task', function (Blueprint $table) {
$table->foreignId('task_id')->constrained('tasks');
$table->foreignId('label_id')->constrained('labels');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('label_task');
}
};

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class LabelSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}