forked from aslan/applicant-site
add resource Documents Online
This commit is contained in:
parent
88c692bfe1
commit
ff2deace3e
|
@ -1,65 +0,0 @@
|
|||
<?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
|
||||
{
|
||||
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,65 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\StoreOnlineDocumentsRequest;
|
||||
use App\Http\Requests\UpdateOnlineDocumentsRequest;
|
||||
use App\Models\OnlineDocuments;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class OnlineDocumentsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$onlineDocuments = OnlineDocuments::all();
|
||||
return view('online-documents.index', compact('onlineDocuments'));
|
||||
}
|
||||
|
||||
public function create(OnlineDocuments $documentOnline): View
|
||||
{
|
||||
if (Auth::guest()) {
|
||||
abort(403);
|
||||
}
|
||||
$parent = $documentOnline;
|
||||
return view('online-documents', compact('parent'));
|
||||
}
|
||||
|
||||
public function store(StoreOnlineDocumentsRequest $request)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(OnlineDocuments $doceumentsOnline)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(OnlineDocuments $doceumentsOnline)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(UpdateOnlineDocumentsRequest $request, OnlineDocuments $doceumentsOnline)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(OnlineDocuments $doceumentsOnline)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ namespace App\Http\Requests;
|
|||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreDocumentsOnlineRequest extends FormRequest
|
||||
class StoreOnlineDocumentsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
|
@ -4,7 +4,7 @@ namespace App\Http\Requests;
|
|||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateDocumentsOnlineRequest extends FormRequest
|
||||
class UpdateOnlineDocumentsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
|
@ -5,14 +5,15 @@ namespace App\Models;
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DocumentsOnline extends Model
|
||||
class OnlineDocuments extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'name',
|
||||
'description',
|
||||
'url'
|
||||
'url',
|
||||
'parent',
|
||||
'children'
|
||||
];
|
||||
}
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\DocumentsOnline;
|
||||
use App\Models\OnlineDocuments;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
|
||||
class DocumentsOnlinePolicy
|
||||
class OnlineDocumentsPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
|
@ -19,7 +19,7 @@ class DocumentsOnlinePolicy
|
|||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, DocumentsOnline $doceumentsOnline): bool
|
||||
public function view(User $user, OnlineDocuments $doceumentsOnline): bool
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class DocumentsOnlinePolicy
|
|||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, DocumentsOnline $doceumentsOnline): bool
|
||||
public function update(User $user, OnlineDocuments $doceumentsOnline): bool
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class DocumentsOnlinePolicy
|
|||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, DocumentsOnline $doceumentsOnline): bool
|
||||
public function delete(User $user, OnlineDocuments $doceumentsOnline): bool
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class DocumentsOnlinePolicy
|
|||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, DocumentsOnline $doceumentsOnline): bool
|
||||
public function restore(User $user, OnlineDocuments $doceumentsOnline): bool
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class DocumentsOnlinePolicy
|
|||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, DocumentsOnline $doceumentsOnline): bool
|
||||
public function forceDelete(User $user, OnlineDocuments $doceumentsOnline): bool
|
||||
{
|
||||
//
|
||||
}
|
|
@ -5,7 +5,7 @@ namespace Database\Factories;
|
|||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\DocumentsOnline>
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\OnlineDocuments>
|
||||
*/
|
||||
class DocumentsOnlineFactory extends Factory
|
||||
{
|
||||
|
|
|
@ -20,8 +20,8 @@ class DatabaseSeeder extends Seeder
|
|||
'email' => 'test@example.com',
|
||||
'password' => 123456
|
||||
]);
|
||||
// $this->call([
|
||||
// DocumentsOnlineSeeder::class
|
||||
// ]);
|
||||
$this->call([
|
||||
OnlineDocumentsSeeder::class
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DocumentsOnlineSeeder extends Seeder
|
||||
class OnlineDocumentsSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('documents_online')->insert([
|
||||
DB::table('online_documents')->insert([
|
||||
[
|
||||
'name' => 'Подать документы онлайн',
|
||||
'url' => '',
|
|
@ -1,8 +0,0 @@
|
|||
@extends('layouts.admin-layout')
|
||||
@section('content')
|
||||
@foreach($documentsOnline as $documentOnline)
|
||||
{{ $documentOnline->name }}
|
||||
{{ $documentOnline->url }}
|
||||
{{ $documentOnline->description }}
|
||||
@endforeach
|
||||
@endsection
|
|
@ -0,0 +1,11 @@
|
|||
@extends('layouts.admin-layout')
|
||||
@section('content')
|
||||
@foreach($onlineDocuments as $onlineDocument)
|
||||
<div>
|
||||
{{ $onlineDocument->name }}
|
||||
{{ $onlineDocument->url }}
|
||||
{{ $onlineDocument->parent }}
|
||||
{{ $onlineDocument->children }}
|
||||
</div>
|
||||
@endforeach
|
||||
@endsection
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\DocumentsOnlineController;
|
||||
use App\Http\Controllers\OnlineDocumentsController;
|
||||
use App\Http\Controllers\ProfileController;
|
||||
use App\Http\Controllers\UploadFileController;
|
||||
use App\Http\Controllers\UserController;
|
||||
|
@ -23,7 +23,7 @@ Route::get('/', function () {
|
|||
|
||||
Route::resources([
|
||||
'/users' => UserController::class,
|
||||
'/documents-online' => DocumentsOnlineController::class
|
||||
'/online-documents' => OnlineDocumentsController::class
|
||||
]);
|
||||
|
||||
Route::get('/course', function () {
|
||||
|
|
Loading…
Reference in New Issue