-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit f0af620
Showing
137 changed files
with
36,500 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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,18 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 | ||
|
||
[docker-compose.yml] | ||
indent_size = 4 |
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,5 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.scss linguist-vendored | ||
*.js linguist-vendored | ||
CHANGELOG.md export-ignore |
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,18 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/public/css/app.css | ||
/public/js/app.js | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.phpunit.result.cache | ||
docker-compose.override.yml | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
/.idea | ||
/.vscode | ||
tags |
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: | ||
preset: laravel | ||
version: 8 | ||
disabled: | ||
- no_unused_imports | ||
finder: | ||
not-name: | ||
- index.php | ||
- server.php | ||
js: | ||
finder: | ||
not-name: | ||
- webpack.mix.js | ||
css: true |
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,4 @@ | ||
|
||
## About Giraffe Api Service | ||
|
||
Laravel Sanctum ... |
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,41 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire')->hourly(); | ||
} | ||
|
||
/** | ||
* Register the commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
$this->load(__DIR__.'/Commands'); | ||
|
||
require base_path('routes/console.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,41 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
use Throwable; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that are not reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
// | ||
]; | ||
|
||
/** | ||
* A list of the inputs that are never flashed for validation exceptions. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontFlash = [ | ||
'current_password', | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Register the exception handling callbacks for the application. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->reportable(function (Throwable $e) { | ||
// | ||
}); | ||
} | ||
} |
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,61 @@ | ||
<?php | ||
|
||
namespace App\Filters; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Database\Eloquent\Builder; | ||
|
||
abstract class Filters | ||
{ | ||
/** | ||
* @var Request $request | ||
*/ | ||
public Request $request; | ||
|
||
/** | ||
* @var Builder $builder | ||
*/ | ||
protected Builder $builder; | ||
|
||
/** | ||
* @var array $filters | ||
*/ | ||
protected array $filters; | ||
|
||
/** | ||
* Filters constructor. | ||
* | ||
* @param Request $request | ||
*/ | ||
public function __construct(Request $request) | ||
{ | ||
$this->request = $request; | ||
} | ||
|
||
/** | ||
* Apply filters to the builder. | ||
* | ||
* @param Builder $builder | ||
* @return Builder | ||
*/ | ||
public function apply(Builder $builder): Builder | ||
{ | ||
$this->builder = $builder; | ||
|
||
collect($this->getFilters())->each(function (?string $value, string $filter) { | ||
if (method_exists($this, $filter)) { | ||
$this->$filter($value); | ||
} | ||
}); | ||
|
||
return $this->builder; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
private function getFilters(): array | ||
{ | ||
return $this->request->only(array_intersect(array_keys($this->request->all()), $this->filters)); | ||
} | ||
} |
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,74 @@ | ||
<?php | ||
|
||
namespace App\Filters; | ||
|
||
use Illuminate\Database\Eloquent\Builder; | ||
|
||
class MarkedIndividualFilters extends Filters | ||
{ | ||
/** | ||
* All the filters available to filter through | ||
* | ||
* @var array | ||
*/ | ||
protected array $filters = [ | ||
'max_age', 'min_age', 'species', 'gender','location', | ||
]; | ||
|
||
public function min_age(?int $min): Builder | ||
{ | ||
if (is_null($min)) { | ||
return $this->builder; | ||
} | ||
|
||
return $this->builder->whereHas('encounters', fn(Builder $query) => $query->where('AGE', '>=', $min)); | ||
} | ||
|
||
public function max_age(?int $max): Builder | ||
{ | ||
if (is_null($max)) { | ||
return $this->builder; | ||
} | ||
|
||
return $this->builder->whereHas('encounters', fn(Builder $query) => $query->where(fn(Builder $q) => $q->where('AGE', '<=', $max)->orWhereNull('AGE'))); | ||
} | ||
|
||
public function species(?string $species): Builder | ||
{ | ||
if (is_null($species)) { | ||
return $this->builder; | ||
} | ||
|
||
return $this->builder->whereHas('encounters', fn(Builder $query) => $query->where('SPECIFICEPITHET', $species)); | ||
} | ||
|
||
/** | ||
* Filter by gender. | ||
* | ||
* @param string|null $gender | ||
* @return Builder | ||
*/ | ||
public function gender(?string $gender): Builder | ||
{ | ||
if (is_null($gender)) { | ||
return $this->builder; | ||
} | ||
|
||
$genders = [ | ||
'm' => ['m', 'M', 'male', 'Male', 'MALE'], | ||
'f' => ['f', 'F', 'female', 'Female', 'FEMALE'], | ||
'u' => ['u', 'U', 'unknown', 'Unknown', 'UNKNOWN', null], | ||
]; | ||
|
||
return $this->builder->whereIn('SEX', $genders[$gender]); | ||
} | ||
|
||
public function location(?string $location) | ||
{ | ||
if (is_null($location)) { | ||
return $this->builder; | ||
} | ||
|
||
return $this->builder->whereHas('encounters', fn(Builder $query) => $query->where('LOCATIONID', $location)); | ||
} | ||
} |
Oops, something went wrong.