WIP: Road to 1.0.0 #1
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Facades\UUID;
|
||||
|
@ -23,6 +42,7 @@ class CreateUser extends Command
|
|||
* @var string
|
||||
*/
|
||||
protected $description = 'Creates an application user. Seeding the database is for testing environments, so use this command in production for your first admin user.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
|
@ -40,9 +60,7 @@ class CreateUser extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
system('cls');
|
||||
} else {
|
||||
|
@ -53,60 +71,43 @@ class CreateUser extends Command
|
|||
$this->info('We\'ll ask some questions to get you started.');
|
||||
|
||||
$username = $this->ask('Username');
|
||||
do
|
||||
{
|
||||
do {
|
||||
$password = $this->secret('Password');
|
||||
$password_confirm = $this->secret('Confirm Password');
|
||||
|
||||
if ($password === $password_confirm)
|
||||
{
|
||||
if ($password === $password_confirm) {
|
||||
$password = Hash::make($password);
|
||||
$matches = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error('Password doesn\'t match. Please try again.');
|
||||
$matches = false;
|
||||
}
|
||||
}
|
||||
while(!$matches);
|
||||
} while (! $matches);
|
||||
|
||||
$email = $this->ask('E-mail address');
|
||||
$name = $this->ask('First/Last Name');
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
do {
|
||||
try {
|
||||
$uuid = UUID::toUUID($this->ask('Minecraft username (Must be a valid Premium account)'));
|
||||
}
|
||||
catch (\InvalidArgumentException $e)
|
||||
{
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->error($e->getMessage());
|
||||
$hasError = true;
|
||||
}
|
||||
|
||||
if (isset($hasError))
|
||||
{
|
||||
if (isset($hasError)) {
|
||||
$continue = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$continue = false;
|
||||
}
|
||||
unset($hasError);
|
||||
}
|
||||
while($continue);
|
||||
|
||||
} while ($continue);
|
||||
|
||||
$this->info('Please check if these details are correct: ');
|
||||
$this->info('Username: '.$username);
|
||||
$this->info('Email: '.$email);
|
||||
$this->info('Name: '.$name);
|
||||
|
||||
}
|
||||
while(!$this->confirm('Create user now? You can go back to correct any details.'));
|
||||
|
||||
} while (! $this->confirm('Create user now? You can go back to correct any details.'));
|
||||
|
||||
$user = User::create([
|
||||
'uuid' => $uuid,
|
||||
|
@ -114,11 +115,10 @@ class CreateUser extends Command
|
|||
'email' => $email,
|
||||
'username' => $username,
|
||||
'originalIP' => '127.0.0.1',
|
||||
'password' => $password
|
||||
'password' => $password,
|
||||
]);
|
||||
|
||||
if ($user)
|
||||
{
|
||||
if ($user) {
|
||||
$user->assignRole('admin', 'reviewer', 'user', 'hiringManager');
|
||||
Profile::create([
|
||||
'profileShortBio' => 'Random data '.rand(0, 1000),
|
||||
|
@ -131,10 +131,9 @@ class CreateUser extends Command
|
|||
$this->info('Account created! You may now login at '.route('login').'. Enjoy the app!');
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error('There was an unknown problem creating the user. There might have been errors above. Please try again.');
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Faker\Factory;
|
||||
use Faker\Generator;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class MakeFile extends Command
|
||||
|
@ -25,7 +42,6 @@ class MakeFile extends Command
|
|||
*/
|
||||
protected $description = 'Generates test files for the TeamFile model. Use in conjunction with it\'s factory.';
|
||||
|
||||
|
||||
/**
|
||||
* The faker instance used to obtain dummy text.
|
||||
*
|
||||
|
@ -55,13 +71,12 @@ class MakeFile extends Command
|
|||
$count = $this->argument('count');
|
||||
$this->info('Creating '.$this->argument('count').' files!');
|
||||
|
||||
for ($max = 1; $max < $count; $max++)
|
||||
{
|
||||
for ($max = 1; $max < $count; $max++) {
|
||||
Storage::disk('local')->put('factory_files/testfile_'.rand(0, 5000).'.txt', $this->faker->paragraphs(40, true));
|
||||
|
||||
}
|
||||
|
||||
$this->info('Finished creating files! They will be randomly picked by the factory.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\TeamFile;
|
||||
|
@ -18,9 +37,9 @@ class TeamFileController extends Controller
|
|||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
if (is_null(Auth::user()->currentTeam))
|
||||
{
|
||||
if (is_null(Auth::user()->currentTeam)) {
|
||||
$request->session()->flash('error', 'Please choose a team before viewing it\'s files.');
|
||||
|
||||
return redirect()->to(route('teams.index'));
|
||||
}
|
||||
|
||||
|
@ -49,18 +68,14 @@ class TeamFileController extends Controller
|
|||
//
|
||||
}
|
||||
|
||||
|
||||
public function download(Request $request, TeamFile $teamFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
return Storage::download('uploads/'.$teamFile->name);
|
||||
}
|
||||
catch (FileNotFoundException $ex)
|
||||
{
|
||||
} catch (FileNotFoundException $ex) {
|
||||
$request->session()->flash('error', 'Sorry, but the requested file could not be found in storage. Sometimes, files may be physically deleted by admins, but not from the app\'s database.');
|
||||
return redirect()->back();
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ class Team extends TeamworkTeam
|
|||
return $this->belongsToMany('App\Vacancy', 'team_has_vacancy');
|
||||
}
|
||||
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->hasMany('App\TeamFile', 'team_id');
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
@ -10,13 +29,12 @@ class TeamFile extends Model
|
|||
{
|
||||
use HasFactory, UsedByTeams;
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'uploaded_by',
|
||||
'team_id',
|
||||
'name',
|
||||
'fs_location',
|
||||
'extension'
|
||||
'extension',
|
||||
];
|
||||
|
||||
public function uploader()
|
||||
|
|
|
@ -616,14 +616,14 @@ return [
|
|||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '/js/plugins/dropzone.min.js'
|
||||
'location' => '/js/plugins/dropzone.min.js',
|
||||
],
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => false,
|
||||
'location' => '/css/dropzone.min.css'
|
||||
]
|
||||
]
|
||||
]
|
||||
'location' => '/css/dropzone.min.css',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,25 @@
|
|||
<?php
|
||||
|
||||
return array(
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| One Signal App Id
|
||||
|
@ -19,5 +38,5 @@ return array(
|
|||
|
|
||||
*/
|
||||
'rest_api_key' => 'YOUR-REST-API-KEY-HERE',
|
||||
'user_auth_key' => 'YOUR-USER-AUTH-KEY'
|
||||
);
|
||||
'user_auth_key' => 'YOUR-USER-AUTH-KEY',
|
||||
];
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\TeamFile;
|
||||
|
@ -32,7 +51,7 @@ class TeamFileFactory extends Factory
|
|||
'description' => $this->faker->paragraphs(3, true),
|
||||
'fs_location' => $this->faker->file($prefix.'factory_files', $prefix.'uploads'),
|
||||
'extension' => 'txt',
|
||||
'size' => rand(1, 1000) // random fake size between 0 bytes and 1 mb
|
||||
'size' => rand(1, 1000), // random fake size between 0 bytes and 1 mb
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Miguel Nogueira
|
||||
*
|
||||
* This file is part of Raspberry Staff Manager.
|
||||
*
|
||||
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Raspberry Staff Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\TeamFile;
|
||||
|
|
|
@ -87,7 +87,6 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['lo
|
|||
Route::get('teams/invites/{action}/{token}', [TeamController::class, 'processInviteAction'])
|
||||
->name('processInvite');
|
||||
|
||||
|
||||
Route::get('team/files', [TeamFileController::class, 'index'])
|
||||
->name('showTeamFiles');
|
||||
|
||||
|
@ -97,7 +96,6 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['lo
|
|||
Route::get('team/files/{teamFile}/download', [TeamFileController::class, 'download'])
|
||||
->name('downloadTeamFile');
|
||||
|
||||
|
||||
Route::group(['prefix' => '/applications'], function () {
|
||||
Route::get('/my-applications', [ApplicationController::class, 'showUserApps'])
|
||||
->name('showUserApps')
|
||||
|
|
Loading…
Reference in New Issue