-
Notifications
You must be signed in to change notification settings - Fork 7
Implements #5311 #5354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Implements #5311 #5354
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
1da9340
worked on sponsor resource
js802025 a90c9ba
Made sponsor nova resource render
jvogt23 0bf49ab
added sponsor and sponsor domain resource
js802025 89ca2ed
Merge branch 'main' into sponsor-model
js802025 2c026a5
added sponsor user resource and email verif
js802025 2e8caa0
fixed formatting
js802025 e70e944
fixed formatting pt 2
js802025 f6d8e25
Update SponsorUserValidEmail.php
js802025 5d94060
lint errors
js802025 bb4f9c3
reformat
js802025 2762b42
Update Sponsor.php
js802025 a840215
Update SponsorUserValidEmail.php
js802025 f8c1b05
Update SponsorUserValidEmail.php
js802025 76c3f2d
fixed phpcs
js802025 f971d11
Update SponsorUserValidEmail.php
js802025 07afc5f
Update SponsorUserValidEmail.php
js802025 05eb933
fixed phan
js802025 03f1d0a
Update SponsorUserValidEmail.php
js802025 478eae8
Update SponsorUserValidEmail.php
js802025 207f912
Update SponsorUserValidEmail.php
js802025 c2ff23b
made requested changes
js802025 9b105f4
Update ImportAllModels.php
js802025 e131fec
added end date indexing
js802025 355597f
removed ids from display
js802025 dcd9f77
removed unused dependencies
js802025 8193419
added creation rules and without trashed flag
js802025 0143b43
Update SponsorUser.php
js802025 9e66aaa
Merge branch 'main' into sponsor-model
jvogt23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -45,3 +45,4 @@ resume-monitoring.sh | |
| .envault.json | ||
| .phpunit.result.cache | ||
| /docs/_build/ | ||
| .DS_Store | ||
This file contains hidden or 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 hidden or 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 hidden or 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,87 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Nova; | ||
|
|
||
| use App\Models\Sponsor as AppModelsSponsor; | ||
| use Laravel\Nova\Fields\Boolean; | ||
| use Laravel\Nova\Fields\DateTime; | ||
| use Laravel\Nova\Fields\HasMany; | ||
| use Laravel\Nova\Fields\Text; | ||
| use Laravel\Nova\Http\Requests\NovaRequest; | ||
| use Laravel\Nova\Resource; | ||
|
|
||
| /** | ||
| * A Nova resource for sponsors. | ||
| * | ||
| * @extends \App\Nova\Resource<\App\Models\Sponsor> | ||
| */ | ||
| class Sponsor extends Resource | ||
| { | ||
| /** | ||
| * The model the resource corresponds to. | ||
| * | ||
| * @var class-string<\App\Models\Sponsor> | ||
| */ | ||
| public static $model = AppModelsSponsor::class; | ||
|
|
||
| /** | ||
| * The single value that should be used to represent the resource when being displayed. | ||
| * | ||
| * @var string | ||
| */ | ||
| public static $title = 'name'; | ||
|
|
||
| /** | ||
| * The logical group associated with the resource. | ||
| * | ||
| * @var string | ||
| */ | ||
| public static $group = 'Other'; | ||
|
|
||
| /** | ||
| * The columns that should be searched. | ||
| * | ||
| * @var array<string> | ||
| */ | ||
| public static $search = [ | ||
| 'id', | ||
| 'name', | ||
| ]; | ||
|
|
||
| /** | ||
| * The number of results to display in the global search. | ||
| * | ||
| * @var int | ||
| */ | ||
| public static $globalSearchResults = 5; | ||
|
|
||
| /** | ||
| * The number of results to display when searching the resource using Scout. | ||
| * | ||
| * @var int | ||
| */ | ||
| public static $scoutSearchResults = 5; | ||
|
|
||
| /** | ||
| * Get the fields displayed by the resource. | ||
| */ | ||
| #[\Override] | ||
| public function fields(NovaRequest $request): array | ||
| { | ||
| return [ | ||
| Text::make('Name') | ||
| ->rules('required', 'max:255') | ||
js802025 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ->creationRules('unique:sponsors,name') | ||
| ->updateRules('unique:sponsors,name,{{resourceId}}') | ||
| ->sortable(), | ||
| DateTime::make('End Date') | ||
| ->rules('required') | ||
| ->sortable(), | ||
| HasMany::make('Domain Names', 'domainNames', SponsorDomain::class), | ||
| HasMany::make('Users', 'users', SponsorUser::class), | ||
| Boolean::make('Active', fn () => $this->active())->onlyOnIndex(), | ||
| ]; | ||
| } | ||
| } | ||
This file contains hidden or 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,83 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Nova; | ||
|
|
||
| use App\Models\SponsorDomain as AppModelsSponsorDomain; | ||
| use Laravel\Nova\Fields\BelongsTo; | ||
| use Laravel\Nova\Fields\Text; | ||
| use Laravel\Nova\Http\Requests\NovaRequest; | ||
| use Laravel\Nova\Resource; | ||
|
|
||
| /** | ||
| * A Nova resource for sponsor domains. | ||
| * | ||
| * @extends \App\Nova\Resource<\App\Models\SponsorDomain> | ||
| */ | ||
| class SponsorDomain extends Resource | ||
| { | ||
| /** | ||
| * The model the resource corresponds to. | ||
| * | ||
| * @var class-string<\App\Models\SponsorDomain> | ||
| */ | ||
| public static $model = AppModelsSponsorDomain::class; | ||
|
|
||
| /** | ||
| * The single value that should be used to represent the resource when being displayed. | ||
| * | ||
| * @var string | ||
| */ | ||
| public static $title = 'domain_name'; | ||
|
|
||
| /** | ||
| * The logical group associated with the resource. | ||
| * | ||
| * @var string | ||
| */ | ||
| public static $group = 'Other'; | ||
|
|
||
| /** | ||
| * The columns that should be searched. | ||
| * | ||
| * @var array<string> | ||
| */ | ||
| public static $search = [ | ||
| 'id', | ||
| 'name', | ||
| ]; | ||
|
|
||
| /** | ||
| * The number of results to display in the global search. | ||
| * | ||
| * @var int | ||
| */ | ||
| public static $globalSearchResults = 5; | ||
|
|
||
| /** | ||
| * The number of results to display when searching the resource using Scout. | ||
| * | ||
| * @var int | ||
| */ | ||
| public static $scoutSearchResults = 5; | ||
|
|
||
| /** | ||
| * Get the fields displayed by the resource. | ||
| */ | ||
| #[\Override] | ||
| public function fields(NovaRequest $request): array | ||
| { | ||
| return [ | ||
| BelongsTo::make('Sponsor', 'sponsor', Sponsor::class) | ||
js802025 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ->withoutTrashed() | ||
| ->rules('required') | ||
| ->sortable(), | ||
| Text::make('Domain Name', 'domain_name') | ||
| ->rules('required', 'max:255') | ||
| ->creationRules('unique:sponsor_domains,domain_name') | ||
| ->updateRules('unique:sponsor_domains,domain_name,{{resourceId}}') | ||
| ->sortable(), | ||
| ]; | ||
| } | ||
| } | ||
This file contains hidden or 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,84 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Nova; | ||
|
|
||
| use App\Models\SponsorUser as AppModelsSponsorUser; | ||
| use App\Rules\SponsorUserValidEmail; | ||
| use Laravel\Nova\Fields\BelongsTo; | ||
| use Laravel\Nova\Fields\Text; | ||
| use Laravel\Nova\Http\Requests\NovaRequest; | ||
| use Laravel\Nova\Resource; | ||
|
|
||
| /** | ||
| * A Nova resource for sponsor users. | ||
| * | ||
| * @extends \App\Nova\Resource<\App\Models\SponsorUser> | ||
| */ | ||
| class SponsorUser extends Resource | ||
| { | ||
| /** | ||
| * The model the resource corresponds to. | ||
| * | ||
| * @var class-string<\App\Models\SponsorUser> | ||
| */ | ||
| public static $model = AppModelsSponsorUser::class; | ||
|
|
||
| /** | ||
| * The single value that should be used to represent the resource when being displayed. | ||
| * | ||
| * @var string | ||
| */ | ||
| public static $title = 'email'; | ||
|
|
||
| /** | ||
| * The logical group associated with the resource. | ||
| * | ||
| * @var string | ||
| */ | ||
| public static $group = 'Other'; | ||
|
|
||
| /** | ||
| * The columns that should be searched. | ||
| * | ||
| * @var array<string> | ||
| */ | ||
| public static $search = [ | ||
| 'id', | ||
| 'name', | ||
| ]; | ||
|
|
||
| /** | ||
| * The number of results to display in the global search. | ||
| * | ||
| * @var int | ||
| */ | ||
| public static $globalSearchResults = 5; | ||
|
|
||
| /** | ||
| * The number of results to display when searching the resource using Scout. | ||
| * | ||
| * @var int | ||
| */ | ||
| public static $scoutSearchResults = 5; | ||
|
|
||
| /** | ||
| * Get the fields displayed by the resource. | ||
| */ | ||
| #[\Override] | ||
| public function fields(NovaRequest $request): array | ||
| { | ||
| return [ | ||
| BelongsTo::make('Sponsor', 'company', Sponsor::class) | ||
| ->withoutTrashed() | ||
| ->rules('required') | ||
| ->sortable(), | ||
| Text::make('Email', 'email') | ||
| ->rules('required', 'email:rfc,strict,dns,spoof', 'max:255', new SponsorUserValidEmail()) | ||
| ->creationRules('unique:sponsor_users,email') | ||
| ->updateRules('unique:sponsor_users,email,{{resourceId}}') | ||
| ->sortable(), | ||
| ]; | ||
| } | ||
| } |
This file contains hidden or 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,75 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Policies; | ||
|
|
||
| use App\Models\SponsorDomain; | ||
| use App\Models\User; | ||
| use Illuminate\Auth\Access\HandlesAuthorization; | ||
|
|
||
| class SponsorDomainPolicy | ||
| { | ||
| use HandlesAuthorization; | ||
|
|
||
| /** | ||
| * Determine whether the user can view any models. | ||
| */ | ||
| public function viewAny(User $user): bool | ||
| { | ||
| return $user->can('view-sponsors'); | ||
| } | ||
|
|
||
| /** | ||
| * Determine whether the user can view the model. | ||
| */ | ||
| public function view(User $user, SponsorDomain $sponsorDomain): bool | ||
| { | ||
| return $user->can('view-sponsors'); | ||
| } | ||
|
|
||
| /** | ||
| * Determine whether the user can create models. | ||
| */ | ||
| public function create(User $user): bool | ||
| { | ||
| return $user->can('manage-sponsors'); | ||
| } | ||
|
|
||
| /** | ||
| * Determine whether the user can update the model. | ||
| */ | ||
| public function update(User $user, SponsorDomain $sponsorDomain): bool | ||
| { | ||
| return $user->can('manage-sponsors'); | ||
| } | ||
|
|
||
| /** | ||
| * Determine whether the user can delete the model. | ||
| */ | ||
| public function delete(User $user, SponsorDomain $sponsorDomain): bool | ||
| { | ||
| return $user->can('manage-sponsors'); | ||
| } | ||
|
|
||
| /** | ||
| * Determine whether the user can restore the model. | ||
| */ | ||
| public function restore(User $user, SponsorDomain $sponsorDomain): bool | ||
| { | ||
| return $user->can('manage-sponsors'); | ||
| } | ||
|
|
||
| /** | ||
| * Determine whether the user can permanently delete the model. | ||
| */ | ||
| public function forceDelete(User $user, SponsorDomain $sponsorDomain): bool | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| public function replicate(User $user, SponsorDomain $sponsorDomain): bool | ||
| { | ||
| return false; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.