Skip to content

Commit

Permalink
Merge pull request #237 from Daedalus11069/update/admin
Browse files Browse the repository at this point in the history
Update admin Laravel install and other minor changes( update/admin branch )
  • Loading branch information
rezalas authored Oct 25, 2023
2 parents 14c69cb + 8b94f81 commit 1d54749
Show file tree
Hide file tree
Showing 114 changed files with 6,353 additions and 48,902 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ tests/libTestMain.a
/vendor
/Homestead.json
/Homestead.yaml
/ca.homestead.riftshadow.crt

# Database Files
!/db/rift/
10 changes: 3 additions & 7 deletions Homestead.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ folders:
to: /home/vagrant/code
#type: "nfs"
sites:
- map: admin.riftshadow.org # can be changed
- map: admin.riftshadow.dev # can be changed
to: /home/vagrant/code/admin/public
databases:
- name: rift
user: rift
pass: rift123
- name: rift_core
user: rift
pass: rift123
- rift
- rift_core
features:
- mysql: true
- mariadb: false
Expand Down
1 change: 1 addition & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ require File.expand_path(confDir + '/scripts/homestead.rb')
Vagrant.require_version '>= 2.2.4'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box_architecture = "amd64"
if File.exist? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
config.vm.provision "shell" do |s|
Expand Down
4 changes: 2 additions & 2 deletions admin/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ APP_NAME="Rift Shadow"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://admin.riftshadow.org
APP_URL=http://admin.riftshadow.dev

LOG_CHANNEL=stack

Expand Down Expand Up @@ -35,7 +35,7 @@ REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
Expand Down
24 changes: 24 additions & 0 deletions admin/.php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

$finder = \PhpCsFixer\Finder::create()
->exclude('node_modules')
->exclude('vendor')
->in(__DIR__)
;

$config = new \PhpCsFixer\Config();

return $config->setRules([
'@PSR1' => true,
'@PSR2' => true,
'@PSR12' => true,
'indentation_type' => true
])
->setIndent("\t")
->setLineEnding("\n")
// This is commented out as otherwise we get 'paths are overridden my command line
// arguments' every time a file is saved, because they are. We want to instead
// rely on the vscode extension to provide the path of the currently-focused
// file.
//->setFinder($finder)
;
9 changes: 8 additions & 1 deletion admin/.phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@

<!-- 2.1 Basic Coding Standard -->

<!-- Code MUST follow all rules outlined in PSR-12. -->
<!-- Code MUST follow all rules outlined in PSR-1. -->
<rule ref="PSR1"/>
<rule ref="PSR1.Files.SideEffects">
<exclude-pattern type="relative">public/index.php</exclude-pattern>
</rule>
<rule ref="PSR12">
<exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed" />
<exclude name="Generic.WhiteSpace.DisallowTabIndent.NonIndentTabsUsed" />
</rule>

<!-- The term 'StudlyCaps' in PSR-1 MUST be interpreted as PascalCase where the first letter of each word is capitalized including the very first letter. -->

Expand Down
9 changes: 9 additions & 0 deletions admin/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"obliviousharmony.vscode-php-codesniffer",
"junstyle.php-cs-fixer",
"neilbrayfield.php-docblocker",
"zobo.php-intellisense",
"syler.sass-indented"
]
}
8 changes: 8 additions & 0 deletions admin/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"php-cs-fixer.executablePathWindows": "",
"php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar",
"php-cs-fixer.onsave": true,
"phpCodeSniffer.standard": "Automatic",
"phpCodeSniffer.autoExecutable": true,
"php-cs-fixer.pathMode": "override"
}
33 changes: 28 additions & 5 deletions admin/app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Exceptions;

use Exception;
use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
Expand All @@ -29,23 +29,46 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @return void
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
parent::report($exception);
}

/**
* Determine if the exception should be reported.
*
* @param \Throwable $e
* @return bool
*/
public function shouldReport(Throwable $e)
{
return parent::shouldReport($e);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Throwable $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}

/**
* Render an exception to the console.
*
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Throwable $e
* @return void
*/
public function renderForConsole($output, Throwable $e)
{
parent::renderForConsole($output, $e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ForgotPasswordController extends Controller
| your application to your users. Feel free to explore this trait.
|
*/

use SendsPasswordResetEmails;

/**
Expand Down
1 change: 0 additions & 1 deletion admin/app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class LoginController extends Controller
| to conveniently provide its functionality to your applications.
|
*/

use AuthenticatesUsers;

/**
Expand Down
12 changes: 5 additions & 7 deletions admin/app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class RegisterController extends Controller
| provide this functionality without requiring any additional code.
|
*/

use RegistersUsers;

/**
Expand Down Expand Up @@ -151,9 +150,9 @@ function ($attribute, $value, $fail) use ($data) {
return;
}


$player_file_test = $this->testPlayerFilePass($value, $player_file_pass);

if ($player_file_test === false) {
$fail(trans('auth.player_files.pass_mismatch', compact('value')));
}
Expand All @@ -177,20 +176,19 @@ protected function create(array $data)
'password' => Hash::make($data['password'])
]);

if (count($player_files) > 0)
{
if (count($player_files) > 0) {
$existingPlayerFiles = PlayerFile::whereIn('name', $player_files)->get();

$newPlayerFileNames = collect($player_files)->diff($existingPlayerFiles->pluck('name'));

$orphanedPlayerFileNames = collect($player_files)->intersect($existingPlayerFiles->pluck('name'));

$orphanedPlayerFiles = PlayerFile::whereIn('name', $orphanedPlayerFileNames)->get();

$newPlayerFileNames->transform(function ($filename) {
return ['name' => $filename];
});

$user->playerFiles()->createMany($newPlayerFileNames->toArray());

$user->playerFiles()->saveMany($orphanedPlayerFiles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ResetPasswordController extends Controller
| explore this trait and override any methods you wish to tweak.
|
*/

use ResetsPasswords;

/**
Expand Down
1 change: 0 additions & 1 deletion admin/app/Http/Controllers/Auth/VerificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class VerificationController extends Controller
| be re-sent if the user didn't receive the original email message.
|
*/

use VerifiesEmails;

/**
Expand Down
7 changes: 3 additions & 4 deletions admin/app/Http/Controllers/ClassesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class ClassesController extends Controller
{

/**
* Instantiate a new controller instance.
*
Expand Down Expand Up @@ -66,7 +65,7 @@ public function store(Request $request)

// Data valid; save...

$class = new ClassTable;
$class = new ClassTable();

$class->name = $validated['name'];
$class->who_name = $validated['abbrev'];
Expand All @@ -81,7 +80,7 @@ public function store(Request $request)
$class->default_group = $validated['default_group'];
$class->ctype = $validated['ctype'];
$class->status = $validated['status'];

$class->save();

return redirect()
Expand Down Expand Up @@ -154,7 +153,7 @@ public function update(Request $request, ClassTable $class)
$class->default_group = $validated['default_group'];
$class->ctype = $validated['ctype'];
$class->status = $validated['status'];

$class->save();

return redirect()
Expand Down
4 changes: 3 additions & 1 deletion admin/app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@

class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}
4 changes: 2 additions & 2 deletions admin/app/Http/Controllers/HelpFilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function index(Request $request)
$helpfilesQuery = $helpfilesQuery->where($c, $comparator, $lq);
}
}

$helpfiles = $helpfilesQuery->paginate();

if ($request->c && $request->q !== '') {
Expand Down Expand Up @@ -84,7 +84,7 @@ public function store(Request $request)
'author' => 'nullable'
]);

$helpfile = new HelpFile;
$helpfile = new HelpFile();

$helpfile->title = $request->title;
$helpfile->skill = $request->skill ?? 'none';
Expand Down
8 changes: 4 additions & 4 deletions admin/app/Http/Controllers/RacesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public function store(Request $request)

$newBitCols = $this->mapFlags($request);

$race = new RaceTable;
$race = new RaceTable();

$race->name = $request->name;
$race->short_name = $request->short_name;
$race->imm_name = $request->imm_name;
Expand Down Expand Up @@ -208,7 +208,7 @@ public function update(Request $request, $race)
]);

$modifiedBitCols = $this->mapFlags($request);

$race->name = $request->name;
$race->short_name = $request->short_name;
$race->imm_name = $request->imm_name;
Expand Down Expand Up @@ -290,7 +290,7 @@ private function mapFlags(Request $request)
];
});
}

/**
* Generate an array containing the select form fields and
* whether they start selected or not
Expand Down
Loading

0 comments on commit 1d54749

Please sign in to comment.