Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion app/Barrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App;

use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Model;

class Barrier extends Model
Expand All @@ -11,7 +12,7 @@ class Barrier extends Model
protected $hidden = [];
public $timestamps = false;

public function barriers()
public function barriers(): BelongsToMany
{
return $this->belongsToMany(\App\Device::class, 'devices_barriers', 'barrier_id', 'device_id');
}
Expand Down
10 changes: 5 additions & 5 deletions app/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ class Category extends Model
public function findAll()
{
try {
return DB::select(DB::raw('SELECT * FROM `'.$this->table.'` WHERE `revision` = :rev'), ['rev' => $this->revision]);
return DB::select("SELECT * FROM `{$this->table}` WHERE `revision` = :rev", ['rev' => $this->revision]);
} catch (\Illuminate\Database\QueryException $e) {
return false;
}
}

public function listed()
{
$clusters = DB::select(DB::raw('SELECT * FROM clusters ORDER BY idclusters ASC'));
$clusters = DB::select('SELECT * FROM clusters ORDER BY idclusters ASC');

$sql = 'SELECT * FROM `'.$this->table.'` WHERE `revision` = :rev AND `cluster` = :cluster ORDER BY `idcategories` ASC';
$sql = "SELECT * FROM `{$this->table}` WHERE `revision` = :rev AND `cluster` = :cluster ORDER BY `idcategories` ASC";

foreach ($clusters as $k => $cluster) {
$clusters[$k]->categories = DB::select(DB::raw($sql), ['rev' => $this->revision, 'cluster' => $cluster->idclusters]);
$clusters[$k]->categories = DB::select($sql, ['rev' => $this->revision, 'cluster' => $cluster->idclusters]);
}

return $clusters;
Expand All @@ -59,7 +59,7 @@ public function listed()
public function findAllByRevision($rev)
{
try {
DB::select(DB::raw('SELECT * FROM `'.$this->table.'` WHERE `revision` = :rev'), ['rev' => $rev]);
return DB::select("SELECT * FROM `{$this->table}` WHERE `revision` = :rev", ['rev' => $rev]);
} catch (\Illuminate\Database\QueryException $e) {
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion app/Cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App;

use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Model;

class Cluster extends Model
Expand All @@ -23,7 +24,7 @@ class Cluster extends Model
*/
protected $hidden = [];

public function categories()
public function categories(): HasMany
{
return $this->hasMany(\App\Category::class, 'cluster', 'idclusters');
}
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/AlertCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$title = trim($this->argument('title'));
$html = trim($this->argument('html'));
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/AnonymiseUsersForTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ class AnonymiseUsersForTest extends Command

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
if (env('APP_ENV') !== 'local') {
$this->error('This command is only designed to be run during local development.');
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/CheckGroupLocations.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$groups = Group::where('approved', true)->get();
$geocoder = new \App\Helpers\Geocoder();
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/CheckTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): int
{
// We want to scan all English translations.
$files = scandir(base_path() . '/lang/en');
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/CreateDiscourseGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$groups = Group::where('approved', true)->whereNull('discourse_group')->get();

Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/CrystalliseEventTimezone.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ public function __construct(DiscourseService $discourseService)

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$events = Party::past()->where('timezone', null)->get();

Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/DiscourseAnonymiseUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ public function __construct(DiscourseService $discourseService)

/**
* Execute the console command.
*
* @return mixed
*/
public function handle(DiscourseService $discourseService)
public function handle(DiscourseService $discourseService): void
{
$id = $this->argument('id');
$user = User::findOrFail($id);
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/DiscourseChangeSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ public function __construct(DiscourseService $discourseService)

/**
* Execute the console command.
*
* @return mixed
*/
public function handle(DiscourseService $discourseService)
public function handle(DiscourseService $discourseService): void
{
$setting = $this->argument('setting');
$value = $this->argument('value');
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/DiscourseCreateThread.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ public function __construct(DiscourseService $discourseService)

/**
* Execute the console command.
*
* @return mixed
*/
public function handle(DiscourseService $discourseService)
public function handle(DiscourseService $discourseService): void
{
$id = $this->argument('partyid');

Expand Down
10 changes: 4 additions & 6 deletions app/Console/Commands/FixViews.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,22 @@ class FixViews extends Command

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
if (env('APP_ENV') !== 'local') {
$this->error('This command is only designed to be run during local development.');

return;
}

$results = DB::select(DB::raw('
$results = DB::select('
SELECT table_name as viewName, CONCAT("ALTER DEFINER=`'.env('DB_USERNAME').'`@`'.env('DB_HOST').'` VIEW `",table_name,"` AS ", view_definition,";") as alter_statement
FROM information_schema.views
WHERE table_schema="'.env('DB_DATABASE').'"'));
WHERE table_schema="'.env('DB_DATABASE').'"');

foreach ($results as $result) {
DB::unprepared(DB::raw($result->alter_statement));
DB::unprepared($result->alter_statement);
$this->info('Fixed '.$result->viewName);
}
}
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/FixVolunteerCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ class FixVolunteerCount extends Command

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$events = Party::all();

Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/GroupCountryField.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ class GroupCountryField extends Command

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$groups = Group::all();

Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/ImportGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$input = $this->argument('input');
$inputFile = fopen($input, 'r');
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/ImportMRES.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$input = $this->argument('input');

Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/LanguageSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
// We want to sync the language preference from restarters to mediawiki.
//
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/MigrateWikiPasswords.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$users = User::whereNotNull('mediawiki')->whereNull('deleted_at')->get();

Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/NetworkCoordinator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$networkname = $this->argument('networkname');

Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/NetworkCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$name = $this->argument('name');
$shortname = $this->argument('shortname');
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/NetworkGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$networkname = $this->argument('networkname');
$groupname = $this->argument('groupname');
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/PopulateUniqueCodeToEventsAndGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ class PopulateUniqueCodeToEventsAndGroups extends Command

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$groups = Group::whereNull('shareable_code')
->get();
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/SetPlaceNetworkData.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$networkname = $this->argument('networkname');

Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/SetRepairTogetherPasswords.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ class SetRepairTogetherPasswords extends Command

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$users = User::where('repair_network', 3)
->where('password', '')
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/SyncDiscourseGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public function __construct(DiscourseService $discourseService)

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$this->discourseService->syncGroups();
}
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/SyncDiscourseUsernames.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ public function __construct(DiscourseService $discourseService)

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$usersFoundInRestarters = 0;
$updatedUsers = 0;
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/SyncEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$eventsQuery = Party::whereNotNull('wordpress_post_id')->where('approved', true);
if (! is_null($this->option('datefrom'))) {
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/SyncGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ public function __construct()

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$groups = Group::where('approved', true)->whereNotNull('wordpress_post_id')->get();

Expand Down
Loading