diff --git a/app/Filament/Resources/Countries/CountryResource.php b/app/Filament/Resources/Countries/CountryResource.php new file mode 100644 index 00000000..a43102b2 --- /dev/null +++ b/app/Filament/Resources/Countries/CountryResource.php @@ -0,0 +1,83 @@ +components([ + TextInput::make('name') + ->required() + ->maxLength(255), + TextInput::make('iso2') + ->required() + ->maxLength(2), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->recordTitleAttribute('name') + ->description('Flags made from iso2 column') + ->columns([ + IconColumn::make('iso2')->icon(function ($record): string { + return 'flag-country-'.$record->iso2; + })->label('Flags')->size(IconSize::TwoExtraLarge), + TextColumn::make('name')->searchable(), + // TextColumn::make('iso2'), + TextColumn::make('iso3'), + TextColumn::make('cc'), + TextColumn::make('numeric'), + TextColumn::make('txid'), + + ]) + ->filters([ + // + ]) + ->recordActions([ + EditAction::make(), + ]); + } + + public static function getNavigationBadge(): ?string + { + return parent::getEloquentQuery()->count(); + } + + public static function getPages(): array + { + return [ + 'index' => ManageCountries::route('/'), + ]; + } +} diff --git a/app/Filament/Resources/Countries/Pages/ManageCountries.php b/app/Filament/Resources/Countries/Pages/ManageCountries.php new file mode 100644 index 00000000..71355676 --- /dev/null +++ b/app/Filament/Resources/Countries/Pages/ManageCountries.php @@ -0,0 +1,19 @@ +hasMany(Liga::class, 'cc', 'cc'); + } +} diff --git a/app/Models/Customer.php b/app/Models/Customer.php new file mode 100644 index 00000000..852b2891 --- /dev/null +++ b/app/Models/Customer.php @@ -0,0 +1,10 @@ +can('view_any_countries::country'); + } + + /** + * Determine whether the user can view the model. + */ + public function view(User $user, Country $country): bool + { + return $user->can('view_countries::country'); + } + + /** + * Determine whether the user can create models. + */ + public function create(User $user): bool + { + return $user->can('create_countries::country'); + } + + /** + * Determine whether the user can update the model. + */ + public function update(User $user, Country $country): bool + { + return $user->can('update_countries::country'); + } + + /** + * Determine whether the user can delete the model. + */ + public function delete(User $user, Country $country): bool + { + return $user->can('delete_countries::country'); + } + + /** + * Determine whether the user can bulk delete. + */ + public function deleteAny(User $user): bool + { + return $user->can('delete_any_countries::country'); + } + + /** + * Determine whether the user can permanently delete. + */ + public function forceDelete(User $user, Country $country): bool + { + return $user->can('force_delete_countries::country'); + } + + /** + * Determine whether the user can permanently bulk delete. + */ + public function forceDeleteAny(User $user): bool + { + return $user->can('force_delete_any_countries::country'); + } + + /** + * Determine whether the user can restore. + */ + public function restore(User $user, Country $country): bool + { + return $user->can('restore_countries::country'); + } + + /** + * Determine whether the user can bulk restore. + */ + public function restoreAny(User $user): bool + { + return $user->can('restore_any_countries::country'); + } + + /** + * Determine whether the user can replicate. + */ + public function replicate(User $user, Country $country): bool + { + return $user->can('replicate_countries::country'); + } + + /** + * Determine whether the user can reorder. + */ + public function reorder(User $user): bool + { + return $user->can('reorder_countries::country'); + } +} diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index 965c2ad9..7c5b66ef 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -26,6 +26,7 @@ use Illuminate\View\Middleware\ShareErrorsFromSession; use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin; use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage; use Swis\Filament\Backgrounds\FilamentBackgroundsPlugin; +use Swis\Filament\Backgrounds\ImageProviders\MyImages; class AdminPanelProvider extends PanelProvider { @@ -82,7 +83,8 @@ class AdminPanelProvider extends PanelProvider ])->plugins([ FilamentEditProfilePlugin::make()->shouldRegisterNavigation(false), LightSwitchPlugin::make()->position(Alignment::BottomCenter), - FilamentBackgroundsPlugin::make(), + FilamentBackgroundsPlugin::make() + ->imageProvider(MyImages::make()->directory('images/backgrounds')), ]); } } diff --git a/app/Utilities/Curl.php b/app/Utilities/Curl.php new file mode 100644 index 00000000..58ecfb50 --- /dev/null +++ b/app/Utilities/Curl.php @@ -0,0 +1,118 @@ + 'CURLE_UNSUPPORTED_PROTOCOL', + 2 => 'CURLE_FAILED_INIT', + 3 => 'CURLE_URL_MALFORMAT', + 4 => 'CURLE_URL_MALFORMAT_USER', + 5 => 'CURLE_COULDNT_RESOLVE_PROXY', + 6 => 'CURLE_COULDNT_RESOLVE_HOST', + 7 => 'CURLE_COULDNT_CONNECT', + 8 => 'CURLE_FTP_WEIRD_SERVER_REPLY', + 9 => 'CURLE_REMOTE_ACCESS_DENIED', + 11 => 'CURLE_FTP_WEIRD_PASS_REPLY', + 13 => 'CURLE_FTP_WEIRD_PASV_REPLY', + 14 => 'CURLE_FTP_WEIRD_227_FORMAT', + 15 => 'CURLE_FTP_CANT_GET_HOST', + 17 => 'CURLE_FTP_COULDNT_SET_TYPE', + 18 => 'CURLE_PARTIAL_FILE', + 19 => 'CURLE_FTP_COULDNT_RETR_FILE', + 21 => 'CURLE_QUOTE_ERROR', + 22 => 'CURLE_HTTP_RETURNED_ERROR', + 23 => 'CURLE_WRITE_ERROR', + 25 => 'CURLE_UPLOAD_FAILED', + 26 => 'CURLE_READ_ERROR', + 27 => 'CURLE_OUT_OF_MEMORY', + 28 => 'CURLE_OPERATION_TIMEDOUT', + 30 => 'CURLE_FTP_PORT_FAILED', + 31 => 'CURLE_FTP_COULDNT_USE_REST', + 33 => 'CURLE_RANGE_ERROR', + 34 => 'CURLE_HTTP_POST_ERROR', + 35 => 'CURLE_SSL_CONNECT_ERROR', + 36 => 'CURLE_BAD_DOWNLOAD_RESUME', + 37 => 'CURLE_FILE_COULDNT_READ_FILE', + 38 => 'CURLE_LDAP_CANNOT_BIND', + 39 => 'CURLE_LDAP_SEARCH_FAILED', + 41 => 'CURLE_FUNCTION_NOT_FOUND', + 42 => 'CURLE_ABORTED_BY_CALLBACK', + 43 => 'CURLE_BAD_FUNCTION_ARGUMENT', + 45 => 'CURLE_INTERFACE_FAILED', + 47 => 'CURLE_TOO_MANY_REDIRECTS', + 48 => 'CURLE_UNKNOWN_TELNET_OPTION', + 49 => 'CURLE_TELNET_OPTION_SYNTAX', + 51 => 'CURLE_PEER_FAILED_VERIFICATION', + 52 => 'CURLE_GOT_NOTHING', + 53 => 'CURLE_SSL_ENGINE_NOTFOUND', + 54 => 'CURLE_SSL_ENGINE_SETFAILED', + 55 => 'CURLE_SEND_ERROR', + 56 => 'CURLE_RECV_ERROR', + 58 => 'CURLE_SSL_CERTPROBLEM', + 59 => 'CURLE_SSL_CIPHER', + 60 => 'CURLE_SSL_CACERT', + 61 => 'CURLE_BAD_CONTENT_ENCODING', + 62 => 'CURLE_LDAP_INVALID_URL', + 63 => 'CURLE_FILESIZE_EXCEEDED', + 64 => 'CURLE_USE_SSL_FAILED', + 65 => 'CURLE_SEND_FAIL_REWIND', + 66 => 'CURLE_SSL_ENGINE_INITFAILED', + 67 => 'CURLE_LOGIN_DENIED', + 68 => 'CURLE_TFTP_NOTFOUND', + 69 => 'CURLE_TFTP_PERM', + 70 => 'CURLE_REMOTE_DISK_FULL', + 71 => 'CURLE_TFTP_ILLEGAL', + 72 => 'CURLE_TFTP_UNKNOWNID', + 73 => 'CURLE_REMOTE_FILE_EXISTS', + 74 => 'CURLE_TFTP_NOSUCHUSER', + 75 => 'CURLE_CONV_FAILED', + 76 => 'CURLE_CONV_REQD', + 77 => 'CURLE_SSL_CACERT_BADFILE', + 78 => 'CURLE_REMOTE_FILE_NOT_FOUND', + 79 => 'CURLE_SSH', + 80 => 'CURLE_SSL_SHUTDOWN_FAILED', + 81 => 'CURLE_AGAIN', + 82 => 'CURLE_SSL_CRL_BADFILE', + 83 => 'CURLE_SSL_ISSUER_ERROR', + 84 => 'CURLE_FTP_PRET_FAILED', + 84 => 'CURLE_FTP_PRET_FAILED', + 85 => 'CURLE_RTSP_CSEQ_ERROR', + 86 => 'CURLE_RTSP_SESSION_ERROR', + 87 => 'CURLE_FTP_BAD_FILE_LIST', + 88 => 'CURLE_CHUNK_FAILED', + 89 => 'CURLE_NO_CONNECTION_AVAILABLE', + 90 => 'CURLE_SSL_PINNEDPUBKEYNOTMATCH', + 91 => 'CURLE_SSL_INVALIDCERTSTATUS', + 92 => 'CURLE_HTTP2_STREAM', + ]; + + return $error_codes[$id]; + } +} diff --git a/app/Utilities/Guzzle.php b/app/Utilities/Guzzle.php new file mode 100644 index 00000000..dc9edb49 --- /dev/null +++ b/app/Utilities/Guzzle.php @@ -0,0 +1,25 @@ +get($url); + + return json_decode($data, true); + } +} diff --git a/app/Utilities/Html.php b/app/Utilities/Html.php new file mode 100644 index 00000000..65d436cd --- /dev/null +++ b/app/Utilities/Html.php @@ -0,0 +1,55 @@ +