-
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.
Merge branch 'feature/da_add_la_basepackage' into develop
- Loading branch information
Showing
34 changed files
with
2,235 additions
and
491 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
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,137 @@ | ||
<?php | ||
|
||
if (! function_exists('getCountriesByIso')) { | ||
|
||
function getCountriesByIso() | ||
{ | ||
$fileContents = file(storage_path('app/country_list.csv')); | ||
foreach ($fileContents as $line) { | ||
$tempLine = str_getcsv($line); | ||
$tempLine[0] = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $tempLine[0]); | ||
$data[$tempLine[0]] = [ | ||
$tempLine[0], | ||
$tempLine[1], | ||
$tempLine[2], | ||
$tempLine[3], | ||
]; | ||
} | ||
|
||
return $data; | ||
} | ||
} | ||
|
||
if (! function_exists('getCountriesByName')) { | ||
function getCountriesByName() | ||
{ | ||
$fileContents = file(storage_path('app/country_list.csv')); | ||
|
||
foreach ($fileContents as $line) { | ||
$tempLine = str_getcsv($line); | ||
$tempLine[0] = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $tempLine[0]); | ||
$data[$tempLine[1]] = [ | ||
$tempLine[0], | ||
$tempLine[1], | ||
$tempLine[2], | ||
$tempLine[3], | ||
]; | ||
} | ||
|
||
return $data; | ||
} | ||
} | ||
|
||
if (! function_exists('csvToArray')) { | ||
function csvToArray($filename = '', $headers = null, $delimiter = ';') | ||
{ | ||
if (! file_exists($filename) || ! is_readable($filename)) { | ||
return false; | ||
} | ||
|
||
$data = []; | ||
if (($handle = fopen($filename, 'r')) !== false) { | ||
$headerSet = false; | ||
while (($row = fgetcsv($handle, 1000, $delimiter)) !== false) { | ||
if (empty($headers) && ! $headerSet) { | ||
$headers = $row; | ||
$headerSet = true; | ||
|
||
continue; | ||
} | ||
$data[] = array_combine($headers, $row); | ||
} | ||
fclose($handle); | ||
} | ||
|
||
return $data; | ||
} | ||
} | ||
|
||
if (! function_exists('get_flag_for_locale')) { | ||
function get_flag_for_locale($locale): string | ||
{ | ||
switch ($locale) { | ||
case 'en': | ||
return 'gb'; | ||
case 'nl': | ||
return 'nl'; | ||
case 'fr': | ||
return 'fr'; | ||
default: | ||
return 'sr'; | ||
} | ||
} | ||
} | ||
|
||
if (! function_exists('printWithQuestionOptions')) { | ||
function printWithQuestionOptions($text, $replace, $key = null): string | ||
{ | ||
if (is_array($replace) && isset($replace[$key])) { | ||
$replace = $replace[$key]; | ||
} | ||
if (empty($replace)) { | ||
$replace = ''; | ||
} | ||
return str_replace(':questionOptions', $replace, $text); | ||
} | ||
} | ||
|
||
if (! function_exists('echoArray')) { | ||
function echoArray($text): string | ||
{ | ||
$print = ''; | ||
if (! is_array($text)) { | ||
|
||
return $print; | ||
|
||
return $text; | ||
} | ||
|
||
foreach ($text as $line) { | ||
$print .= $line.'<br>'; | ||
} | ||
|
||
return $print; | ||
} | ||
} | ||
|
||
//if (! function_exists('compareVariables')) { | ||
// function compareVariables($value1, $operator, $value2): string | ||
// { | ||
// switch ($operator) { | ||
// case '<': | ||
// return $value1 < $value2; | ||
// case '<=': | ||
// return $value1 <= $value2; | ||
// case '>': | ||
// return $value1 > $value2; | ||
// case '>=': | ||
// return $value1 >= $value2; | ||
// case '==': | ||
// return $value1 == $value2; | ||
// case '!=': | ||
// return $value1 != $value2; | ||
// default: | ||
// return false; | ||
// } | ||
// } | ||
//} |
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,38 @@ | ||
<?php | ||
|
||
/** | ||
* Created by Reliese Model. | ||
*/ | ||
|
||
namespace App\Models; | ||
|
||
use Carbon\Carbon; | ||
use Illuminate\Database\Eloquent\Collection; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
/** | ||
* Class Role | ||
* | ||
* @property int $id | ||
* @property string $name | ||
* @property Carbon|null $created_at | ||
* @property Carbon|null $updated_at | ||
* @property Collection|User[] $users | ||
*/ | ||
class Role extends Model | ||
{ | ||
protected $table = 'roles'; | ||
|
||
const USER = 1; | ||
|
||
const ADMINISTRATOR = 2; | ||
|
||
protected $fillable = [ | ||
'name', | ||
]; | ||
|
||
public function users() | ||
{ | ||
return $this->hasMany(User::class); | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -4,13 +4,20 @@ | |
"description": "The skeleton application for the Laravel framework.", | ||
"keywords": ["laravel", "framework"], | ||
"license": "MIT", | ||
"repositories": [ | ||
{ | ||
"type": "vcs", | ||
"url": "[email protected]:UtrechtUniversity/HTS-AppTeam-LaravelBase.git" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"doctrine/dbal": "^3.8", | ||
"guzzlehttp/guzzle": "^7.2", | ||
"laravel/framework": "^10.10", | ||
"laravel/sanctum": "^3.3", | ||
"laravel/tinker": "^2.8" | ||
"laravel/tinker": "^2.8", | ||
"utrecht_university/hts_appteam_laravelbase": "^2.0" | ||
}, | ||
"require-dev": { | ||
"fakerphp/faker": "^1.9.1", | ||
|
@@ -26,7 +33,10 @@ | |
"App\\": "app/", | ||
"Database\\Factories\\": "database/factories/", | ||
"Database\\Seeders\\": "database/seeders/" | ||
} | ||
}, | ||
"files": [ | ||
"app/Http/Helpers.php" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
|
Oops, something went wrong.