work with databases
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Has been cancelled
Details
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Has been cancelled
Details
This commit is contained in:
parent
01081d6ae9
commit
c5c17f0d58
|
@ -13,7 +13,8 @@ class LabelController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
$labels = Label::all();
|
||||
return view('admin.labels.index', compact('labels'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,20 +4,12 @@ namespace Database\Factories;
|
|||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Department>
|
||||
*/
|
||||
class DepartmentFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'name' => fake()->name(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,20 +4,13 @@ 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 [
|
||||
//
|
||||
'name' => fake()->name(),
|
||||
'description' => fake()->text(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,20 +4,15 @@ namespace Database\Factories;
|
|||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Note>
|
||||
*/
|
||||
class NoteFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'name' => fake()->name(),
|
||||
'file' => fake()->name(),
|
||||
'description' => fake()->text(),
|
||||
'task_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,20 +4,18 @@ namespace Database\Factories;
|
|||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Task>
|
||||
*/
|
||||
class TaskFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'name' => fake()->name(),
|
||||
'file' => fake()->name(),
|
||||
'description' => fake()->text(),
|
||||
'parent_id' => 0,
|
||||
'status_id' => 1,
|
||||
'department_id' => 1,
|
||||
'created_by_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,20 +4,12 @@ namespace Database\Factories;
|
|||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\TaskStatuses>
|
||||
*/
|
||||
class TaskStatusesFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'name' => fake()->name(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,21 +6,10 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
|||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
|
@ -32,9 +21,6 @@ class UserFactory extends Factory
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
|
|
|
@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
|
@ -37,9 +34,6 @@ return new class extends Migration
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
|
|
|
@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
|
@ -24,9 +21,6 @@ return new class extends Migration
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
|
|
|
@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
|
@ -45,9 +42,6 @@ return new class extends Migration
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
|
|
|
@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('task_statuses', function (Blueprint $table) {
|
||||
|
@ -18,9 +15,6 @@ return new class extends Migration
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('task_statuses');
|
||||
|
|
|
@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('labels', function (Blueprint $table) {
|
||||
|
@ -19,9 +16,6 @@ return new class extends Migration
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('labels');
|
||||
|
|
|
@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('departments', function (Blueprint $table) {
|
||||
|
@ -17,10 +14,6 @@ return new class extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('departments');
|
||||
|
|
|
@ -6,27 +6,21 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tasks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255);
|
||||
$table->bigInteger('parent_id');
|
||||
$table->text('description')->nullable();
|
||||
$table->string('url', 255)->nullable();
|
||||
$table->string('file', 255)->nullable();
|
||||
$table->foreignId('status_id')->constrained('task_statuses');
|
||||
$table->foreignId('department_id')->constrained('departments');
|
||||
$table->foreignId('created_by_id')->constrained('users');
|
||||
$table->bigInteger('assigned_to_id')->nullable();
|
||||
$table->foreign('assigned_to_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tasks');
|
||||
|
|
|
@ -6,9 +6,7 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('label_task', function (Blueprint $table) {
|
||||
|
@ -18,9 +16,6 @@ return new class extends Migration
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('label_task');
|
||||
|
|
|
@ -6,22 +6,18 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('notes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255);
|
||||
$table->text('description')->nullable();
|
||||
$table->string('file', 255)->nullable();
|
||||
$table->foreignId('task_id')->constrained('tasks');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notes');
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_task', function (Blueprint $table) {
|
||||
$table->foreignId('task_id')->constrained('tasks');
|
||||
$table->foreignId('user_id')->constrained('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('label_task');
|
||||
}
|
||||
};
|
|
@ -5,6 +5,7 @@ namespace Database\Seeders;
|
|||
use App\Models\User;
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
|
@ -18,6 +19,7 @@ class DatabaseSeeder extends Seeder
|
|||
User::factory()->create([
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
'password' => Hash::make('password'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,32 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DepartmentSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
DB::table('departments')->insert([
|
||||
[
|
||||
'name' => 'отдел Разработки',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'отдел Технического обеспечения',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'отдел Кадров',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'Зарплатный отдел',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,32 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LabelSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
DB::table('labels')->insert([
|
||||
[
|
||||
'name' => 'разработка',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'приказ № 1000',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'Срочно',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'повышенный приоритет',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,35 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class NoteSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
DB::table('notes')->insert([
|
||||
[
|
||||
'name' => 'добавлен приказ',
|
||||
'description' => 'разработка',
|
||||
'file' => 'file1.pdf',
|
||||
'task_id' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'приказ № 1000',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'Срочно',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'повышенный приоритет',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
@extends('layouts.layout')
|
||||
@section('content')
|
||||
|
||||
asdasdasd
|
||||
@endsection
|
|
@ -1,5 +1,25 @@
|
|||
@extends('layouts.app')
|
||||
@extends('layouts.layout')
|
||||
@section('content')
|
||||
|
||||
asdasdasd
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">отдел</th>
|
||||
<th scope="col">Задача</th>
|
||||
<th scope="col">Статус</th>
|
||||
<th scope="col">Назначил</th>
|
||||
<th scope="col">Исполнители</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">1</th>
|
||||
<td>Mark</td>
|
||||
<td>Otto</td>
|
||||
<td>@mdo</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@endsection
|
||||
|
|
|
@ -6,8 +6,34 @@
|
|||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>ToDo</title>
|
||||
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<nav class="navbar navbar-expand-lg bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">ToDo</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ request()->is('admin/tasks*') ? 'active' : '' }}" aria-current="page" href="{{ route('tasks.index') }}">Задачи</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ request()->is('admin/task_statuses*') ? 'active' : '' }}" aria-current="page" href="{{ route('task_statuses.index') }}">Статусы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ request()->is('admin/labels*') ? 'active' : '' }}" href="{{ route('labels.index') }}">Метки</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="container mt-4">
|
||||
@yield('content')
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\LabelController;
|
||||
use App\Http\Controllers\ProfileController;
|
||||
use App\Http\Controllers\TaskController;
|
||||
use App\Http\Controllers\TaskStatusesController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', function () {
|
||||
|
@ -17,4 +20,11 @@ Route::middleware('auth')->group(function () {
|
|||
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
||||
});
|
||||
|
||||
Route::middleware(['auth', 'verified'])->prefix('admin')->group(function () {
|
||||
Route::resources([
|
||||
'/tasks' => TaskController::class,
|
||||
'/labels' => LabelController::class,
|
||||
'/task_statuses' => TaskStatusesController::class,
|
||||
]);
|
||||
});
|
||||
require __DIR__.'/auth.php';
|
||||
|
|
|
@ -5,6 +5,7 @@ export default defineConfig({
|
|||
plugins: [
|
||||
laravel({
|
||||
input: [
|
||||
'resources/sass/app.scss',
|
||||
'resources/css/app.css',
|
||||
'resources/js/app.js',
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue