Compare commits

..

No commits in common. "7a585aa3cd164834e90a63e8ca331fb7207573a6" and "b5ec4e72f64d50f9babbe480a212257aa0e374cc" have entirely different histories.

6 changed files with 23 additions and 26 deletions

View File

@ -44,26 +44,23 @@ class FileController extends Controller
{
abort_if(Auth::guest(), 403);
$nameFile = $request->file('url')->getClientOriginalName();
$name = Storage::put('public', $request->file('url'));
$content = $request->file('url');
WorkWithFiles::saveFileToUploads($content);
$newPath = WorkWithFiles::renameFile($content);
$url = $request->file('file');
$return = Storage::put('file.jpg', $content);
dd($return);
$validated = $request->validated();
$file = new File();
$file->name = $validated['name'];
$file->file_name = $nameFile;
$file->url = Storage::url($name);
$file->url = $newPath;
$file->position = $validated['position'];
$file->reception_screen_id = $validated['idReceptionScreen'];
$file->save();
return redirect()->route('files.index');
}
public function download($id)
{
$file = (new File())->find($id);
return Storage::url($file->url);
}
public function edit(int $idFile)
{
abort_if(Auth::guest(), 403);

View File

@ -13,9 +13,8 @@ class File extends Model
protected $fillable = [
'id',
'name',
'file_name',
'url',
'description',
'description'
];
public function receptionScreen(): BelongsTo

View File

@ -10,26 +10,25 @@
"require": {
"php": "^8.1|8.2",
"guzzlehttp/guzzle": "^7.8.1",
"imangazaliev/didom": "^2.0.1",
"laravel/framework": "^10.42.0",
"imangazaliev/didom": "^2.0",
"laravel/framework": "^10.41.0",
"laravel/sanctum": "^3.3.3",
"laravel/tinker": "^2.9.0",
"laravel/ui": "^4.4.0",
"laravelcollective/html": "^6.4.1",
"league/flysystem": "^3.23.1"
"laravel/ui": "^4.4",
"laravelcollective/html": "^6.4.1"
},
"require-dev": {
"fakerphp/faker": "^1.23.1",
"laravel/breeze": "^1.28.1",
"laravel/pint": "^1.13.10",
"laravel/sail": "^1.27.2",
"laravel/pint": "^1.13.9",
"laravel/sail": "^1.27.1",
"mockery/mockery": "^1.6.7",
"nunomaduro/collision": "^7.10.0",
"phpunit/phpunit": "^10.5.9",
"phpunit/phpunit": "^10.5.8",
"spatie/laravel-ignition": "^2.4.1",
"barryvdh/laravel-ide-helper": "^2.13.0",
"squizlabs/php_codesniffer": "^3.8.1",
"phpstan/phpstan": "^1.10.57"
"phpstan/phpstan": "^1.10.56"
},
"autoload": {
"psr-4": {

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "39967a89029d0be1b3179419bf4d8511",
"content-hash": "5bc9c65b7acd466b9ce68980e20268db",
"packages": [
{
"name": "brick/math",

View File

@ -14,7 +14,6 @@ return new class extends Migration
Schema::create('files', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('file_name');
$table->string('description')->nullable();
$table->string('url');
$table->integer('position');

View File

@ -2,8 +2,9 @@
use App\Http\Controllers\FileController;
use App\Http\Controllers\PageController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\ReceptionScreenController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\UploadFileController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;
@ -30,7 +31,6 @@ Route::get('/files/create/{file?}', [FileController::class, 'create'])->name('fi
Route::patch('/files/{file}', [FileController::class, 'update'])->name('files.update');
Route::delete('files/{file}', [FileController::class, 'destroy'])->name('files.destroy');
Route::get('/files/edit/{file}', [FileController::class, 'edit'])->name('files.edit');
Route::get('/files/download/{file}', [FileController::class, 'download'])->name('files.download');
Route::get('/course', function () {
return view('menu.course');
@ -109,6 +109,9 @@ Route::get('/academic-mobility-and-international-cooperation', function () {
})->name('akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo');
Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile');
Route::get('/dashboard', function () {
return view('admin');
})->middleware(['auth', 'verified'])->name('dashboard');