Recent changes

This commit is contained in:
2020-11-02 21:44:05 +00:00
parent 06d1e0ad3f
commit 96aa01b9c6
508 changed files with 333 additions and 79 deletions

0
app/Http/Controllers/ApplicationController.php Normal file → Executable file
View File

0
app/Http/Controllers/AppointmentController.php Normal file → Executable file
View File

View File

0
app/Http/Controllers/Auth/ForgotPasswordController.php Normal file → Executable file
View File

0
app/Http/Controllers/Auth/LoginController.php Normal file → Executable file
View File

0
app/Http/Controllers/Auth/RegisterController.php Normal file → Executable file
View File

0
app/Http/Controllers/Auth/ResetPasswordController.php Normal file → Executable file
View File

0
app/Http/Controllers/Auth/TwofaController.php Normal file → Executable file
View File

0
app/Http/Controllers/Auth/VerificationController.php Normal file → Executable file
View File

0
app/Http/Controllers/BanController.php Normal file → Executable file
View File

0
app/Http/Controllers/CommentController.php Normal file → Executable file
View File

0
app/Http/Controllers/ContactController.php Normal file → Executable file
View File

0
app/Http/Controllers/Controller.php Normal file → Executable file
View File

0
app/Http/Controllers/DashboardController.php Normal file → Executable file
View File

0
app/Http/Controllers/DevToolsController.php Normal file → Executable file
View File

0
app/Http/Controllers/FormController.php Normal file → Executable file
View File

0
app/Http/Controllers/HomeController.php Normal file → Executable file
View File

0
app/Http/Controllers/OptionsController.php Normal file → Executable file
View File

0
app/Http/Controllers/ProfileController.php Normal file → Executable file
View File

0
app/Http/Controllers/ResponseController.php Normal file → Executable file
View File

0
app/Http/Controllers/StaffProfileController.php Normal file → Executable file
View File

0
app/Http/Controllers/TeamController.php Normal file → Executable file
View File

102
app/Http/Controllers/TeamFileController.php Normal file → Executable file
View File

@@ -2,11 +2,25 @@
namespace App\Http\Controllers;
// Most of these namespaces have no effect on the code, however, they're used by IDEs so they can resolve return types and for PHPDocumentor as well
use App\TeamFile;
use Illuminate\Http\Request;
use App\Http\Requests\UploadFileRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\FileNotFoundException;
// Documentation-purpose namespaces
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class TeamFileController extends Controller
{
@@ -14,7 +28,7 @@ class TeamFileController extends Controller
* Display a listing of the resource.
*
* @param Request $request
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Http\Response
* @return Application|Factory|View|Response
*/
public function index(Request $request)
{
@@ -25,28 +39,45 @@ class TeamFileController extends Controller
}
return view('dashboard.teams.team-files')
->with('files', TeamFile::with('team', 'uploader')->paginate(20));
->with('files', TeamFile::with('team', 'uploader')->paginate(6));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param UploadFileRequest $request
* @return RedirectResponse
*/
public function store(Request $request)
public function store(UploadFileRequest $request)
{
//
$upload = $request->file('file');
$file = $upload->store('uploads');
$originalFileName = $upload->getClientOriginalName();
$originalFileExtension = $upload->extension();
$originalFileSize = $upload->getSize();
$fileEntry = TeamFile::create([
'uploaded_by' => Auth::user()->id,
'team_id' => Auth::user()->currentTeam->id,
'name' => $originalFileName,
'caption' => $request->caption,
'description' => $request->description,
'fs_location' => $file,
'extension' => $originalFileExtension,
'size' => $originalFileSize
]);
if ($fileEntry && !is_bool($file))
{
$request->session()->flash('success', 'File uploaded successfully!');
return redirect()->back();
}
$request->session()->flash('error', 'There was an unknown error whilst trying to upload your file.');
return redirect()->back();
}
@@ -54,7 +85,7 @@ class TeamFileController extends Controller
{
try
{
return Storage::download('uploads/' . $teamFile->name);
return Storage::download($teamFile->fs_location, $teamFile->name);
}
catch (FileNotFoundException $ex)
{
@@ -64,22 +95,11 @@ class TeamFileController extends Controller
}
}
/**
* Display the specified resource.
*
* @param \App\TeamFile $teamFile
* @return \Illuminate\Http\Response
*/
public function show(TeamFile $teamFile)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\TeamFile $teamFile
* @return \Illuminate\Http\Response
* @return Response
*/
public function edit(TeamFile $teamFile)
{
@@ -91,7 +111,7 @@ class TeamFileController extends Controller
*
* @param \Illuminate\Http\Request $request
* @param \App\TeamFile $teamFile
* @return \Illuminate\Http\Response
* @return Response
*/
public function update(Request $request, TeamFile $teamFile)
{
@@ -101,11 +121,25 @@ class TeamFileController extends Controller
/**
* Remove the specified resource from storage.
*
* @param \App\TeamFile $teamFile
* @return \Illuminate\Http\Response
* @param Request $request
* @param \App\TeamFile $teamFile
* @return RedirectResponse
*/
public function destroy(TeamFile $teamFile)
public function destroy(Request $request, TeamFile $teamFile)
{
//
try
{
Storage::delete($teamFile->fs_location);
$teamFile->delete();
$request->session()->flash('success', 'File deleted successfully.');
}
catch (\Exception $ex)
{
$request->session()->flash('error', 'There was an error deleting the file: ' . $ex->getMessage());
}
return redirect()->back();
}
}

0
app/Http/Controllers/UserController.php Normal file → Executable file
View File

0
app/Http/Controllers/VacancyController.php Normal file → Executable file
View File

0
app/Http/Controllers/VoteController.php Normal file → Executable file
View File

0
app/Http/Kernel.php Normal file → Executable file
View File

0
app/Http/Middleware/ApplicationEligibility.php Normal file → Executable file
View File

0
app/Http/Middleware/Authenticate.php Normal file → Executable file
View File

0
app/Http/Middleware/Bancheck.php Normal file → Executable file
View File

0
app/Http/Middleware/CheckForMaintenanceMode.php Normal file → Executable file
View File

0
app/Http/Middleware/EncryptCookies.php Normal file → Executable file
View File

0
app/Http/Middleware/ForceLogoutMiddleware.php Normal file → Executable file
View File

0
app/Http/Middleware/RedirectIfAuthenticated.php Normal file → Executable file
View File

0
app/Http/Middleware/TrimStrings.php Normal file → Executable file
View File

0
app/Http/Middleware/TrustProxies.php Normal file → Executable file
View File

0
app/Http/Middleware/UsernameUUID.php Normal file → Executable file
View File

0
app/Http/Middleware/VerifyCsrfToken.php Normal file → Executable file
View File

0
app/Http/Requests/Add2FASecretRequest.php Normal file → Executable file
View File

0
app/Http/Requests/BanUserRequest.php Normal file → Executable file
View File

0
app/Http/Requests/ChangeEmailRequest.php Normal file → Executable file
View File

0
app/Http/Requests/ChangePasswordRequest.php Normal file → Executable file
View File

0
app/Http/Requests/DeleteUserRequest.php Normal file → Executable file
View File

0
app/Http/Requests/EditTeamRequest.php Normal file → Executable file
View File

0
app/Http/Requests/FlushSessionsRequest.php Normal file → Executable file
View File

0
app/Http/Requests/NewCommentRequest.php Normal file → Executable file
View File

0
app/Http/Requests/NewTeamRequest.php Normal file → Executable file
View File

0
app/Http/Requests/ProfileSave.php Normal file → Executable file
View File

0
app/Http/Requests/Remove2FASecretRequest.php Normal file → Executable file
View File

0
app/Http/Requests/SaveNotesRequest.php Normal file → Executable file
View File

0
app/Http/Requests/SearchPlayerRequest.php Normal file → Executable file
View File

0
app/Http/Requests/SendInviteRequest.php Normal file → Executable file
View File

0
app/Http/Requests/UpdateUserRequest.php Normal file → Executable file
View File

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UploadFileRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'caption' => 'required|string|max:100',
'description' => 'required|string|max:800',
'file' => 'required|file|mimes:jpeg,jpg,png,bmp,tiff,docx,doc,odt,ott,xls,xlsx,ods,ots,gif,pdf,mp3,mp4,pptx,ppt,odp,ppsx,pub,psd,svg'
];
}
}

0
app/Http/Requests/UserDeleteRequest.php Normal file → Executable file
View File

0
app/Http/Requests/VacancyEditRequest.php Normal file → Executable file
View File

0
app/Http/Requests/VacancyRequest.php Normal file → Executable file
View File

0
app/Http/Requests/VoteRequest.php Normal file → Executable file
View File