add documents online resource
This commit is contained in:
parent
20f07f19b1
commit
04cb20e7a1
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\StoreDocumentsOnlineRequest;
|
||||
use App\Http\Requests\UpdateDocumentsOnlineRequest;
|
||||
use App\Models\DocumentsOnline;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class DocumentsOnlineController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$documentsOnline = DocumentsOnline::all();
|
||||
return view('documents-online.index', compact('documentsOnline'));
|
||||
}
|
||||
|
||||
public function create(DocumentsOnline $documentOnline): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
|
||||
{
|
||||
if (Auth::guest()) {
|
||||
abort(403);
|
||||
}
|
||||
$parent = $documentOnline;
|
||||
return view('documents-online', compact('parent'));
|
||||
}
|
||||
|
||||
public function store(StoreDocumentsOnlineRequest $request)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(DocumentsOnline $doceumentsOnline)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(DocumentsOnline $doceumentsOnline)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(UpdateDocumentsOnlineRequest $request, DocumentsOnline $doceumentsOnline)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(DocumentsOnline $doceumentsOnline)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreDocumentsOnlineRequest 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 [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateDocumentsOnlineRequest 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 [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DocumentsOnline extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'name',
|
||||
'description',
|
||||
'url'
|
||||
];
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\DocumentsOnline;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
|
||||
class DocumentsOnlinePolicy
|
||||
{
|
||||
/**
|
||||
* 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, DocumentsOnline $doceumentsOnline): 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, DocumentsOnline $doceumentsOnline): bool
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, DocumentsOnline $doceumentsOnline): bool
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, DocumentsOnline $doceumentsOnline): bool
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, DocumentsOnline $doceumentsOnline): bool
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\DocumentsOnline>
|
||||
*/
|
||||
class DocumentsOnlineFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?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('documents_online', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('url');
|
||||
$table->string('parent');
|
||||
$table->string('children');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('documents_online');
|
||||
}
|
||||
};
|
|
@ -13,12 +13,15 @@ class DatabaseSeeder extends Seeder
|
|||
*/
|
||||
public function run(): void
|
||||
{
|
||||
\App\Models\User::factory(10)->create();
|
||||
User::factory(10)->create();
|
||||
|
||||
\App\Models\User::factory()->create([
|
||||
User::factory()->create([
|
||||
'name' => 'admin',
|
||||
'email' => 'test@example.com',
|
||||
'password' => 123456
|
||||
]);
|
||||
// $this->call([
|
||||
// DocumentsOnlineSeeder::class
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DocumentsOnlineSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('documents_online')->insert([
|
||||
[
|
||||
'name' => 'Подать документы онлайн',
|
||||
'url' => '',
|
||||
'parent' => '0',
|
||||
'children' => '2/3',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'По образовательным программам высшего образования',
|
||||
'url' => '',
|
||||
'parent' => '1',
|
||||
'children' => '',
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'По образовательным программам среднего профессионального образования (колледж)',
|
||||
'url' => '',
|
||||
'parent' => '1',
|
||||
'children' => '',
|
||||
'created_at' => Carbon::now(),
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
@extends('layouts.admin-layout')
|
||||
@section('content')
|
||||
@foreach($documentsOnline as $documentOnline)
|
||||
{{ $documentOnline->name }}
|
||||
{{ $documentOnline->url }}
|
||||
{{ $documentOnline->description }}
|
||||
@endforeach
|
||||
@endsection
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\DocumentsOnlineController;
|
||||
use App\Http\Controllers\ProfileController;
|
||||
use App\Http\Controllers\UploadFileController;
|
||||
use App\Http\Controllers\UserController;
|
||||
|
@ -20,7 +21,10 @@ Route::get('/', function () {
|
|||
return view('home');
|
||||
})->name('home');
|
||||
|
||||
Route::resource('/users', UserController::class);
|
||||
Route::resources([
|
||||
'/users' => UserController::class,
|
||||
'/documents-online' => DocumentsOnlineController::class
|
||||
]);
|
||||
|
||||
Route::get('/course', function () {
|
||||
return view('pages.course');
|
||||
|
@ -33,7 +37,7 @@ Route::get('/abitur', function () {
|
|||
Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile');
|
||||
|
||||
Route::get('/dashboard', function () {
|
||||
return view('dashboard');
|
||||
return view('admin');
|
||||
})->middleware(['auth', 'verified'])->name('dashboard');
|
||||
|
||||
Route::middleware('auth')->group(function () {
|
||||
|
|
Loading…
Reference in New Issue