-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Theodorus Doni
authored and
Theodorus Doni
committed
Aug 9, 2023
1 parent
9e68caf
commit 897741c
Showing
158 changed files
with
75,183 additions
and
840 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace App\Enums; | ||
|
||
enum ConferenceFilterEnum: string { | ||
case ALL = 'all'; | ||
case FUTURE = 'future'; | ||
case FAVORITE = 'favorites'; | ||
case DISMISSED = 'dismissed'; | ||
case OPENCFC = 'open_cfp'; | ||
case UNCLOSEDCFP = 'unclosed_cfp'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Enums; | ||
|
||
enum ConferenceSortEnum: string { | ||
case ALPHA = 'alpha'; | ||
case DATE = 'date'; | ||
case OPENINGNEXT = 'opening_next'; | ||
case CLOSSINGNEXT = 'closing_next'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
class AllConferenceFilter extends ConferenceFilter implements ConferenceApiFilter | ||
{ | ||
public function filter() | ||
{ | ||
return $this->model->undismissed()->approved(); | ||
} | ||
|
||
public function filterApi() | ||
{ | ||
return $this->model; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
interface ConferenceApiFilter | ||
{ | ||
public function filterApi(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
use App\Models\Conference; | ||
|
||
abstract class ConferenceFilter | ||
{ | ||
protected $model; | ||
|
||
public function __construct(Conference $model) | ||
{ | ||
$this->model = $model; | ||
} | ||
|
||
public abstract function filter(); | ||
} |
39 changes: 39 additions & 0 deletions
39
app/Factory/Conferences/Filter/ConferenceFilterFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
use App\Models\Conference; | ||
|
||
class ConferenceFilterFactory | ||
{ | ||
private $model; | ||
|
||
public function __construct(Conference $model) | ||
{ | ||
$this->model = $model; | ||
} | ||
|
||
public function getFilter($filterKey) : ConferenceFilter | ||
{ | ||
return match($filterKey) | ||
{ | ||
'favorites' => new FavoriteConferenceFilter($this->model), | ||
'dismissed' => new DismissedConferenceFilter($this->model), | ||
'open_cfp' => new OpenCfpConferenceFilter($this->model), | ||
'unclosed_cfp' => new UnclosedCfpConferenceFilter($this->model), | ||
'all' => new AllConferenceFilter($this->model), | ||
default => new FutureConferenceFilter($this->model) | ||
}; | ||
} | ||
|
||
public function getFilterApi($filterKey) : ConferenceApiFilter | ||
{ | ||
return match($filterKey) | ||
{ | ||
'all' => new AllConferenceFilter($this->model), | ||
'future' => new FutureConferenceFilter($this->model), | ||
'open_cfp' => new OpenCfpConferenceFilter($this->model), | ||
default => new UnclosedCfpConferenceFilter($this->model) | ||
}; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/Factory/Conferences/Filter/DismissedConferenceFilter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
use Illuminate\Support\Facades\Auth; | ||
|
||
class DismissedConferenceFilter extends ConferenceFilter | ||
{ | ||
public function filter() | ||
{ | ||
$user = Auth::user(); | ||
return $user->dismissedConferences()->approved(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/Factory/Conferences/Filter/FavoriteConferenceFilter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
use Illuminate\Support\Facades\Auth; | ||
|
||
class FavoriteConferenceFilter extends ConferenceFilter | ||
{ | ||
public function filter() | ||
{ | ||
$user = Auth::user(); | ||
return $user->favoritedConferences()->approved(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
class FutureConferenceFilter extends ConferenceFilter implements ConferenceApiFilter | ||
{ | ||
public function filter() | ||
{ | ||
return $this->model->undismissed()->future()->approved(); | ||
} | ||
|
||
public function filterApi() | ||
{ | ||
return $this->model->future(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
app/Factory/Conferences/Filter/OpenCfpConferenceFilter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
class OpenCfpConferenceFilter extends ConferenceFilter implements ConferenceApiFilter | ||
{ | ||
public function filter() | ||
{ | ||
return $this->model->undismissed()->openCfp()->approved(); | ||
} | ||
|
||
public function filterApi() | ||
{ | ||
return $this->model->openCfp(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
app/Factory/Conferences/Filter/UnclosedCfpConferenceFilter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
class UnclosedCfpConferenceFilter extends ConferenceFilter implements ConferenceApiFilter | ||
{ | ||
public function filter() | ||
{ | ||
return $this->model->undismissed()->unclosedCfp()->approved(); | ||
} | ||
|
||
public function filterApi() | ||
{ | ||
return $this->model->unclosedCfp(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
class AcceptedTalkFilter extends TalkFilter | ||
{ | ||
public function filter() | ||
{ | ||
return $this->getUserTalks()->accepted()->get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
class SubmittedTalkFilter extends TalkFilter | ||
{ | ||
public function filter() | ||
{ | ||
return $this->getUserTalks()->submitted()->get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
abstract class TalkFilter | ||
{ | ||
protected function getUserTalks() | ||
{ | ||
$user = Auth::user(); | ||
return $user->talks(); | ||
} | ||
|
||
public abstract function filter(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
class TalkFilterFactory | ||
{ | ||
public function getFilter($filterKey) : TalkFilter | ||
{ | ||
return match($filterKey) | ||
{ | ||
'submitted' => new SubmittedTalkFilter(), | ||
'accepted' => new AcceptedTalkFilter(), | ||
default => new UserTalkFilter() | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App\Factory; | ||
|
||
class UserTalkFilter extends TalkFilter | ||
{ | ||
public function filter() | ||
{ | ||
return $this->getUserTalks()->get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace App\Handler; | ||
|
||
use App\Models\User; | ||
use Intervention\Image\Facades\Image; | ||
use Illuminate\Support\Facades\Storage; | ||
|
||
class FileService | ||
{ | ||
public function updateUserProfilePicture($profilePictureName, $inputPictureFile) | ||
{ | ||
$generateProfilePicture = $this->createProfilePictureFile($inputPictureFile); | ||
|
||
Storage::delete([ | ||
User::PROFILE_PICTURE_THUMB_PATH . $profilePictureName, | ||
User::PROFILE_PICTURE_HIRES_PATH . $profilePictureName, | ||
]); | ||
|
||
Storage::put(User::PROFILE_PICTURE_THUMB_PATH . | ||
$inputPictureFile->hashName(), $generateProfilePicture['thumbImage']->stream()); | ||
Storage::put(User::PROFILE_PICTURE_HIRES_PATH . | ||
$inputPictureFile->hashName(), $generateProfilePicture['hiresImage']->stream()); | ||
} | ||
|
||
private function createProfilePictureFile($fileImage) | ||
{ | ||
$thumbImageSize = 250; | ||
$hiresImageSize = 1250; | ||
|
||
$thumbImage = Image::make($fileImage->getRealPath()) | ||
->fit($thumbImageSize, $thumbImageSize); | ||
|
||
$hiresImage = Image::make($fileImage->getRealPath()) | ||
->fit($hiresImageSize, $hiresImageSize, function ($constraint) { $constraint->upsize(); }); | ||
|
||
return [ | ||
'hiresImage' => $hiresImage, | ||
'thumbImage' => $thumbImage, | ||
]; | ||
} | ||
|
||
public function createUserDataJsonFile($name, $data) | ||
{ | ||
Storage::disk('local')->put($name, json_encode($data)); | ||
} | ||
} |
Oops, something went wrong.