Skip to content

Commit

Permalink
Merge commit '5c7b95fec70385aabe1ebeacbac839d29f7d32e3'
Browse files Browse the repository at this point in the history
  • Loading branch information
ilumos committed Jun 22, 2019
2 parents 7318930 + 5c7b95f commit 1bfad2d
Show file tree
Hide file tree
Showing 53 changed files with 903 additions and 867 deletions.
3 changes: 2 additions & 1 deletion app/Console/Commands/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Symfony\Component\Process\Process;

class Backup extends Command
Expand Down Expand Up @@ -61,7 +62,7 @@ public function handle()
// steam_apps - will be restored from Steam API
// logs - often very large
// sessions - temporary
if (str_contains($table, ['migrations', 'steam_apps', 'logs', 'sessions', 'phpdebugbar'])) {
if (Str::contains($table, ['migrations', 'steam_apps', 'logs', 'sessions', 'phpdebugbar'])) {
continue;
}
$processes["mysqldump-$table"] = new Process(
Expand Down
19 changes: 10 additions & 9 deletions app/Console/Commands/Development/MakeFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Zeropingheroes\Lanager\Console\Commands\Development;

use Illuminate\Console\Command;
use Illuminate\Support\Str;

class MakeFeature extends Command
{
Expand Down Expand Up @@ -30,16 +31,16 @@ public function __construct()
*/
public function handle()
{
$name = studly_case(str_singular($this->argument('name')));
$name = Str::studly(str_singular($this->argument('name')));

$this->replacements = [
'model' => $name,
'variable' => camel_case($name),
'variables' => camel_case(str_plural($name, 2)),
'route' => kebab_case(str_plural($name, 2)),
'view' => kebab_case(str_plural($name, 2)),
'lang' => kebab_case($name),
'langs' => kebab_case(str_plural($name, 2)),
'variable' => Str::camel($name),
'variables' => Str::camel(str_plural($name, 2)),
'route' => Str::kebab(str_plural($name, 2)),
'view' => Str::kebab(str_plural($name, 2)),
'lang' => Str::kebab($name),
'langs' => Str::kebab(str_plural($name, 2)),
'table' => snake_case(str_plural($name, 2)),
];

Expand Down Expand Up @@ -100,7 +101,7 @@ private function makeViews()
if (!is_dir(dirname($outputPath))) {
mkdir(dirname($outputPath), 755, true);
}
$label = 'View "' . studly_case(basename($viewStub, '.stub')) . '"';
$label = 'View "' . Str::studly(basename($viewStub, '.stub')) . '"';
$this->makeFileFromStub(__DIR__ . '/stubs/views/' . $viewStub, $outputPath, $label);
}
}
Expand All @@ -112,7 +113,7 @@ private function makeViews()
*/
private function makeFileFromStub($stubPath, $outputPath, $label = null, $append = false)
{
$label = $label ?? studly_case(basename($stubPath, '.stub'));
$label = $label ?? Str::studly(basename($stubPath, '.stub'));

if (!file_exists($stubPath)) {
$this->error(__('phrase.item-not-found', ['item' => $label . ' stub']));
Expand Down
5 changes: 3 additions & 2 deletions app/Console/Commands/UpgradeDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;

class UpgradeDatabase extends Command
{
Expand Down Expand Up @@ -111,6 +112,7 @@ private function dropTables()
$tablesToDrop = [
'states',
'servers',
'event_types',
'applications',
'logs',
'migrations',
Expand All @@ -135,7 +137,6 @@ private function fixTimestamps()
$tablesWithStandardTimestamps = [
'achievements',
'event_signups',
'event_types',
'pages',
'roles',
'user_achievements',
Expand Down Expand Up @@ -329,7 +330,7 @@ private function upgradeRoles()
DB::table('roles')
->where('id', $role->id)
->update([
'name' => kebab_case($role->name),
'name' => Str::kebab($role->name),
'display_name' => $role->name,
]);
}
Expand Down
10 changes: 0 additions & 10 deletions app/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class Event extends Model
{
protected $fillable = [
'lan_id',
'event_type_id',
'name',
'description',
'published',
Expand All @@ -27,17 +26,8 @@ class Event extends Model

protected $with = [
'lan',
'type',
];

/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function type()
{
return $this->belongsTo('Zeropingheroes\Lanager\EventType', 'event_type_id');
}

/**
* @return \Illuminate\Database\Eloquent\Relations\belongsTo
*/
Expand Down
13 changes: 0 additions & 13 deletions app/EventType.php

This file was deleted.

8 changes: 5 additions & 3 deletions app/Http/Controllers/Api/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ class EventController extends Controller
*/
public function index(Request $request)
{
$events = Event::where('published', 1);
$events = Event::where('published', true);

if ($request->filled('after')) {
$events->where('start', '>', $request->after);
$events->orWhere('end', '>', $request->after);
$events->where(function ($query) use ($request) {
$query->where('start', '>', $request->after)
->orWhere('end', '>', $request->after);
});
}

if ($request->filled('limit')) {
Expand Down
11 changes: 2 additions & 9 deletions app/Http/Controllers/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Support\Facades\View;
use Zeropingheroes\Lanager\Event;
use Illuminate\Http\Request;
use Zeropingheroes\Lanager\EventType;
use Zeropingheroes\Lanager\Lan;
use Zeropingheroes\Lanager\Requests\StoreEventRequest;

Expand Down Expand Up @@ -44,11 +43,8 @@ public function create(Lan $lan)
{
$this->authorize('create', Event::class);

$eventTypes = EventType::orderBy('name')->get();

return View::make('pages.events.create')
->with('lan', $lan)
->with('eventTypes', $eventTypes)
->with('event', new Event);
}

Expand All @@ -71,7 +67,6 @@ public function store(Request $httpRequest, Lan $lan)
'end' => $httpRequest->input('end'),
'signups_open' => $httpRequest->input('signups_open'),
'signups_close' => $httpRequest->input('signups_close'),
'event_type_id' => $httpRequest->input('event_type_id'),
'published' => $httpRequest->has('published'),
];

Expand Down Expand Up @@ -126,11 +121,8 @@ public function edit(Lan $lan, Event $event)
abort(404);
}

$eventTypes = EventType::orderBy('name')->get();

return View::make('pages.events.edit')
->with('lan', $lan)
->with('eventTypes', $eventTypes)
->with('event', $event);
}

Expand All @@ -152,7 +144,8 @@ public function update(Request $httpRequest, Lan $lan, Event $event)
'description' => $httpRequest->input('description'),
'start' => $httpRequest->input('start'),
'end' => $httpRequest->input('end'),
'event_type_id' => $httpRequest->input('event_type_id'),
'signups_open' => $httpRequest->input('signups_open'),
'signups_close' => $httpRequest->input('signups_close'),
'published' => $httpRequest->has('published'),
];

Expand Down
131 changes: 0 additions & 131 deletions app/Http/Controllers/EventTypeController.php

This file was deleted.

5 changes: 3 additions & 2 deletions app/Http/Controllers/GuideController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Zeropingheroes\Lanager\Http\Controllers;

use Illuminate\Support\Facades\View;
use Illuminate\Support\Str;
use Zeropingheroes\Lanager\Lan;
use Zeropingheroes\Lanager\Guide;
use Illuminate\Http\Request;
Expand Down Expand Up @@ -92,10 +93,10 @@ public function show(Lan $lan, Guide $guide, $slug = '')
// If the guide is accessed without the URL slug
// or an incorrect slug
// redirect to the guide with the right slug
if (!$slug || $slug != str_slug($guide->title)) {
if (!$slug || $slug != Str::slug($guide->title)) {
return redirect()->route(
'lans.guides.show',
['lan' => $guide->lan_id, 'guide' => $guide, 'slug' => str_slug($guide->title)]
['lan' => $guide->lan_id, 'guide' => $guide, 'slug' => Str::slug($guide->title)]
);
}

Expand Down
5 changes: 3 additions & 2 deletions app/Http/Controllers/ImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Zeropingheroes\Lanager\Requests\StoreImageRequest;
use Zeropingheroes\Lanager\Requests\UpdateImageRequest;
Expand Down Expand Up @@ -86,7 +87,7 @@ public function store(Request $httpRequest)

$fileName = str_replace($extension, '', $fileNameWithExtension);

$newFileName = str_slug($fileName) . '.' . strtolower($extension);
$newFileName = Str::slug($fileName) . '.' . strtolower($extension);

$image->storeAs($this::directory, $newFileName);
}
Expand Down Expand Up @@ -137,7 +138,7 @@ public function update(Request $httpRequest, string $filename)

$originalFilePath = $this::directory . '/' . $filename;
$originalFileExtension = File::extension($originalFilePath);
$newFilenameWithoutExtension = str_before($httpRequest->input('filename'), '.' . $originalFileExtension);
$newFilenameWithoutExtension = Str::before($httpRequest->input('filename'), '.' . $originalFileExtension);
$newFilePath = $this::directory . '/' . $newFilenameWithoutExtension . '.' . $originalFileExtension;

$input = [
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/LogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LogController extends Controller
*/
public function index(Request $request)
{
$this->authorize('view', Log::class);
$this->authorize('index', Log::class);

$logs = Log::with('user')
->filter($request->all())
Expand Down
Loading

0 comments on commit 1bfad2d

Please sign in to comment.