Compare commits
No commits in common. "b72fcc938f6af931b40a29d0140f2355f4959ba9" and "36579ed25f151ba7676923d58d050003e1713b5c" have entirely different histories.
b72fcc938f
...
36579ed25f
|
@ -1,3 +0,0 @@
|
||||||
RewriteEngine on
|
|
||||||
RewriteCond %{REQUEST_URI} !^public
|
|
||||||
RewriteRule ^(.*)$ public/$1 [L]
|
|
|
@ -14,7 +14,6 @@ use Illuminate\Contracts\View\Factory;
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
|
|
||||||
class FileController extends Controller
|
class FileController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -48,10 +47,6 @@ class FileController extends Controller
|
||||||
WorkWithFiles::saveFileToUploads($content);
|
WorkWithFiles::saveFileToUploads($content);
|
||||||
$newPath = WorkWithFiles::renameFile($content);
|
$newPath = WorkWithFiles::renameFile($content);
|
||||||
|
|
||||||
$url = $request->file('file');
|
|
||||||
$return = Storage::put('file.jpg', $content);
|
|
||||||
dd($return);
|
|
||||||
|
|
||||||
$validated = $request->validated();
|
$validated = $request->validated();
|
||||||
$file = new File();
|
$file = new File();
|
||||||
$file->name = $validated['name'];
|
$file->name = $validated['name'];
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use App\Models\ReceptionScreen;
|
|
||||||
use Illuminate\Contracts\View\Factory;
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Illuminate\Foundation\Application;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
class PageController extends Controller
|
|
||||||
{
|
|
||||||
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
|
|
||||||
{
|
|
||||||
$receptionScreens = ReceptionScreen::all()->sortBy('position');
|
|
||||||
return view('menu.reception-screen', compact('receptionScreens'));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class UploadFileController extends Controller
|
||||||
|
{
|
||||||
|
public function showUploadFile(Request $request)
|
||||||
|
{
|
||||||
|
$file = $request->file('image');
|
||||||
|
|
||||||
|
//Display File Name
|
||||||
|
echo 'File Name: ' . $file->getClientOriginalName();
|
||||||
|
echo '<br>';
|
||||||
|
|
||||||
|
//Display File Extension
|
||||||
|
echo 'File Extension: ' . $file->getClientOriginalExtension();
|
||||||
|
echo '<br>';
|
||||||
|
|
||||||
|
//Display File Real Path
|
||||||
|
echo 'File Real Path: ' . $file->getRealPath();
|
||||||
|
echo '<br>';
|
||||||
|
|
||||||
|
//Display File Size
|
||||||
|
echo 'File Size: ' . $file->getSize();
|
||||||
|
echo '<br>';
|
||||||
|
|
||||||
|
//Display File Mime Type
|
||||||
|
echo 'File Mime Type: ' . $file->getMimeType();
|
||||||
|
|
||||||
|
//Move Uploaded File
|
||||||
|
$destinationPath = 'uploads';
|
||||||
|
$file->move($destinationPath, $file->getClientOriginalName());
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "5bc9c65b7acd466b9ce68980e20268db",
|
"content-hash": "fdefaf46b5f41fa6a367dece0d5b67f0",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
|
@ -1045,58 +1045,6 @@
|
||||||
],
|
],
|
||||||
"time": "2023-12-03T19:50:20+00:00"
|
"time": "2023-12-03T19:50:20+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "imangazaliev/didom",
|
|
||||||
"version": "2.0.1",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/Imangazaliev/DiDOM.git",
|
|
||||||
"reference": "50fa6595d14f22c0c984efed5c818485cf548136"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/Imangazaliev/DiDOM/zipball/50fa6595d14f22c0c984efed5c818485cf548136",
|
|
||||||
"reference": "50fa6595d14f22c0c984efed5c818485cf548136",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"ext-dom": "*",
|
|
||||||
"ext-iconv": "*",
|
|
||||||
"php": ">=7.2"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^8.5"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"DiDom\\": "src/DiDom/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Imangazaliev Muhammad",
|
|
||||||
"email": "imangazalievm@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Simple and fast HTML parser",
|
|
||||||
"homepage": "https://github.com/Imangazaliev/DiDOM",
|
|
||||||
"keywords": [
|
|
||||||
"didom",
|
|
||||||
"html",
|
|
||||||
"parser",
|
|
||||||
"xml"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/Imangazaliev/DiDOM/issues",
|
|
||||||
"source": "https://github.com/Imangazaliev/DiDOM/tree/2.0.1"
|
|
||||||
},
|
|
||||||
"time": "2023-03-05T03:23:48+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v10.42.0",
|
"version": "v10.42.0",
|
||||||
|
@ -1876,16 +1824,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/flysystem",
|
"name": "league/flysystem",
|
||||||
"version": "3.23.1",
|
"version": "3.23.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/flysystem.git",
|
"url": "https://github.com/thephpleague/flysystem.git",
|
||||||
"reference": "199e1aebbe3e62bd39f4d4fc8c61ce0b3786197e"
|
"reference": "d4ad81e2b67396e33dc9d7e54ec74ccf73151dcc"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/199e1aebbe3e62bd39f4d4fc8c61ce0b3786197e",
|
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d4ad81e2b67396e33dc9d7e54ec74ccf73151dcc",
|
||||||
"reference": "199e1aebbe3e62bd39f4d4fc8c61ce0b3786197e",
|
"reference": "d4ad81e2b67396e33dc9d7e54ec74ccf73151dcc",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1950,7 +1898,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/thephpleague/flysystem/issues",
|
"issues": "https://github.com/thephpleague/flysystem/issues",
|
||||||
"source": "https://github.com/thephpleague/flysystem/tree/3.23.1"
|
"source": "https://github.com/thephpleague/flysystem/tree/3.23.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -1962,20 +1910,20 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-01-26T18:42:03+00:00"
|
"time": "2023-12-04T10:16:17+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/flysystem-local",
|
"name": "league/flysystem-local",
|
||||||
"version": "3.23.1",
|
"version": "3.23.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/flysystem-local.git",
|
"url": "https://github.com/thephpleague/flysystem-local.git",
|
||||||
"reference": "b884d2bf9b53bb4804a56d2df4902bb51e253f00"
|
"reference": "5cf046ba5f059460e86a997c504dd781a39a109b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/b884d2bf9b53bb4804a56d2df4902bb51e253f00",
|
"url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/5cf046ba5f059460e86a997c504dd781a39a109b",
|
||||||
"reference": "b884d2bf9b53bb4804a56d2df4902bb51e253f00",
|
"reference": "5cf046ba5f059460e86a997c504dd781a39a109b",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2010,7 +1958,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/thephpleague/flysystem-local/issues",
|
"issues": "https://github.com/thephpleague/flysystem-local/issues",
|
||||||
"source": "https://github.com/thephpleague/flysystem-local/tree/3.23.1"
|
"source": "https://github.com/thephpleague/flysystem-local/tree/3.23.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -2022,20 +1970,20 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-01-26T18:25:23+00:00"
|
"time": "2023-12-04T10:14:46+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/mime-type-detection",
|
"name": "league/mime-type-detection",
|
||||||
"version": "1.15.0",
|
"version": "1.14.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/mime-type-detection.git",
|
"url": "https://github.com/thephpleague/mime-type-detection.git",
|
||||||
"reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301"
|
"reference": "b6a5854368533df0295c5761a0253656a2e52d9e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301",
|
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b6a5854368533df0295c5761a0253656a2e52d9e",
|
||||||
"reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301",
|
"reference": "b6a5854368533df0295c5761a0253656a2e52d9e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2066,7 +2014,7 @@
|
||||||
"description": "Mime-type detection for Flysystem",
|
"description": "Mime-type detection for Flysystem",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
|
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
|
||||||
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.15.0"
|
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.14.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -2078,7 +2026,7 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-01-28T23:22:08+00:00"
|
"time": "2023-10-17T14:13:20+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "monolog/monolog",
|
"name": "monolog/monolog",
|
||||||
|
@ -6282,16 +6230,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/dbal",
|
"name": "doctrine/dbal",
|
||||||
"version": "3.8.0",
|
"version": "3.7.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/dbal.git",
|
"url": "https://github.com/doctrine/dbal.git",
|
||||||
"reference": "d244f2e6e6bf32bff5174e6729b57214923ecec9"
|
"reference": "ce594cbc39a4866c544f1a970d285ff0548221ad"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/dbal/zipball/d244f2e6e6bf32bff5174e6729b57214923ecec9",
|
"url": "https://api.github.com/repos/doctrine/dbal/zipball/ce594cbc39a4866c544f1a970d285ff0548221ad",
|
||||||
"reference": "d244f2e6e6bf32bff5174e6729b57214923ecec9",
|
"reference": "ce594cbc39a4866c544f1a970d285ff0548221ad",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -6375,7 +6323,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/doctrine/dbal/issues",
|
"issues": "https://github.com/doctrine/dbal/issues",
|
||||||
"source": "https://github.com/doctrine/dbal/tree/3.8.0"
|
"source": "https://github.com/doctrine/dbal/tree/3.7.3"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -6391,7 +6339,7 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-01-25T21:44:02+00:00"
|
"time": "2024-01-21T07:53:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/deprecations",
|
"name": "doctrine/deprecations",
|
||||||
|
@ -9379,7 +9327,7 @@
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "^8.1|8.2"
|
"php": "^8.2"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.6.0"
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3 col-md-4">
|
<div class="col-lg-3 col-md-4">
|
||||||
<a href="{{ route('reception-screens') }}">
|
<a href="#">
|
||||||
<div class="tp-feature__item before-color-3 mb-40">
|
<div class="tp-feature__item before-color-3 mb-40">
|
||||||
<div class="tp-feature__icon">
|
<div class="tp-feature__icon">
|
||||||
<img style="max-width: 26%;" src="{{ URL::to('img/courses/ekrpriem.png') }}" alt="">
|
<img style="max-width: 26%;" src="{{ URL::to('img/courses/ekrpriem.png') }}" alt="">
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
@extends('layouts.applicant-layout')
|
|
||||||
@section('content')
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.buttonHover {
|
|
||||||
transition: .3s all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttonHover:hover {
|
|
||||||
background-color: #006147;
|
|
||||||
transform: scale(1.03);
|
|
||||||
color: #e0e0e0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="container my-4">
|
|
||||||
<div class="row d-flex justify-content-center align-items-center">
|
|
||||||
@foreach($receptionScreens as $receptionScreen)
|
|
||||||
<div class="col-8">
|
|
||||||
<a href="{{ route('web-consultations') }}">
|
|
||||||
<h4>
|
|
||||||
<div
|
|
||||||
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
|
|
||||||
{{ $receptionScreen->name }}
|
|
||||||
</div>
|
|
||||||
</h4>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@foreach($receptionScreen->files as $file)
|
|
||||||
<div class="col-8">
|
|
||||||
<a href="{{ $file->url }}">{{ $file->name }}</a>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
@endforeach
|
|
||||||
<div class="col-8">
|
|
||||||
<a href="ui-4.html#">
|
|
||||||
<h4>
|
|
||||||
<div
|
|
||||||
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
|
|
||||||
Калькулятор ЕГЭ
|
|
||||||
</div>
|
|
||||||
</h4>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
@endsection
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\FileController;
|
use App\Http\Controllers\FileController;
|
||||||
use App\Http\Controllers\PageController;
|
|
||||||
use App\Http\Controllers\ReceptionScreenController;
|
use App\Http\Controllers\ReceptionScreenController;
|
||||||
use App\Http\Controllers\ProfileController;
|
use App\Http\Controllers\ProfileController;
|
||||||
use App\Http\Controllers\UploadFileController;
|
use App\Http\Controllers\UploadFileController;
|
||||||
|
@ -57,7 +56,7 @@ Route::get('/training courses', function () {
|
||||||
})->name('podgotovitelnye-kursy');
|
})->name('podgotovitelnye-kursy');
|
||||||
|
|
||||||
|
|
||||||
Route::get('/reception-screens', [PageController::class, 'index'])->name('reception-screens');
|
|
||||||
|
|
||||||
|
|
||||||
Route::get('/web-consultations', function () {
|
Route::get('/web-consultations', function () {
|
||||||
|
|
|
@ -1,131 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature;
|
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use Tests\TestCase;
|
|
||||||
|
|
||||||
class ReceptionScreenTest extends TestCase
|
|
||||||
{
|
|
||||||
private User $adminUser;
|
|
||||||
private User $noAdminUser;
|
|
||||||
private array $user;
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
$this->user = User::factory()->make()->only([
|
|
||||||
'name',
|
|
||||||
'email',
|
|
||||||
'password'
|
|
||||||
]);
|
|
||||||
$this->adminUser = User::factory()->create([
|
|
||||||
'name' => 'admin',
|
|
||||||
'email' => 'test@example.com',
|
|
||||||
'password' => 123456
|
|
||||||
]);
|
|
||||||
$this->noAdminUser = User::factory()->create([
|
|
||||||
'name' => 'noadmin',
|
|
||||||
'email' => 'notest@example.com',
|
|
||||||
'password' => 'no123456'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
public function testUsersPage(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->adminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->get(route('users.index'));
|
|
||||||
|
|
||||||
$response->assertOk();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testNoAdminNoSeeUsersPage(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->noAdminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->get(route('users.index'));
|
|
||||||
|
|
||||||
$response->assertStatus(403);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCreateUserPage(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->adminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->get(route('users.create'));
|
|
||||||
|
|
||||||
$response->assertOk();
|
|
||||||
}
|
|
||||||
public function testNoAdminCreateUserPage(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->noAdminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->get(route('users.create'));
|
|
||||||
|
|
||||||
$response->assertStatus(403);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testStoreUser(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->adminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->post(route('users.store', $this->user));
|
|
||||||
|
|
||||||
$response->assertRedirect(route('users.index'));
|
|
||||||
|
|
||||||
$this->assertDatabaseHas('users', $this->user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testNoAdminNoStoreUser(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->noAdminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->post(route('users.store', $this->user));
|
|
||||||
|
|
||||||
$response->assertStatus(403);
|
|
||||||
|
|
||||||
$this->assertDatabaseMissing('users', $this->user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testEditUserPage(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->adminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->get(route('users.edit', $this->adminUser));
|
|
||||||
|
|
||||||
$response->assertOk();
|
|
||||||
}
|
|
||||||
public function testNoAdminEditUserPage(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->noAdminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->get(route('users.edit', $this->noAdminUser));
|
|
||||||
|
|
||||||
$response->assertStatus(403);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUpdateUser(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->adminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->patch(route('users.update', $this->noAdminUser), $this->user);
|
|
||||||
|
|
||||||
$response->assertRedirect(route('users.index'));
|
|
||||||
|
|
||||||
$dataWithOutHashPassword = $this->user;
|
|
||||||
unset($dataWithOutHashPassword['password']);
|
|
||||||
$this->assertDatabaseHas('users', $dataWithOutHashPassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testNoAdminNoUpdateUser(): void
|
|
||||||
{
|
|
||||||
$response = $this->actingAs($this->noAdminUser)
|
|
||||||
->withSession(['banned' => false])
|
|
||||||
->patch(route('users.update', $this->noAdminUser), $this->user);
|
|
||||||
|
|
||||||
$response->assertStatus(403);
|
|
||||||
|
|
||||||
$noAdminData = $this->noAdminUser->only(['name', 'email', 'password']);
|
|
||||||
$this->assertDatabaseHas('users', $noAdminData);
|
|
||||||
$this->assertDatabaseMissing('users', $this->user);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue