Skip to content
Merged
Show file tree
Hide file tree
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 Oct 12, 2025
a90c9ba
Made sponsor nova resource render
jvogt23 Oct 18, 2025
0bf49ab
added sponsor and sponsor domain resource
js802025 Oct 18, 2025
89ca2ed
Merge branch 'main' into sponsor-model
js802025 Oct 18, 2025
2c026a5
added sponsor user resource and email verif
js802025 Oct 18, 2025
2e8caa0
fixed formatting
js802025 Oct 18, 2025
e70e944
fixed formatting pt 2
js802025 Oct 18, 2025
f6d8e25
Update SponsorUserValidEmail.php
js802025 Oct 18, 2025
5d94060
lint errors
js802025 Oct 18, 2025
bb4f9c3
reformat
js802025 Oct 18, 2025
2762b42
Update Sponsor.php
js802025 Oct 18, 2025
a840215
Update SponsorUserValidEmail.php
js802025 Oct 18, 2025
f8c1b05
Update SponsorUserValidEmail.php
js802025 Oct 18, 2025
76c3f2d
fixed phpcs
js802025 Oct 18, 2025
f971d11
Update SponsorUserValidEmail.php
js802025 Oct 18, 2025
07afc5f
Update SponsorUserValidEmail.php
js802025 Oct 18, 2025
05eb933
fixed phan
js802025 Oct 18, 2025
03f1d0a
Update SponsorUserValidEmail.php
js802025 Oct 18, 2025
478eae8
Update SponsorUserValidEmail.php
js802025 Oct 18, 2025
207f912
Update SponsorUserValidEmail.php
js802025 Oct 18, 2025
c2ff23b
made requested changes
js802025 Oct 21, 2025
9b105f4
Update ImportAllModels.php
js802025 Oct 21, 2025
e131fec
added end date indexing
js802025 Oct 24, 2025
355597f
removed ids from display
js802025 Oct 27, 2025
dcd9f77
removed unused dependencies
js802025 Oct 27, 2025
8193419
added creation rules and without trashed flag
js802025 Oct 29, 2025
0143b43
Update SponsorUser.php
js802025 Nov 1, 2025
9e66aaa
Merge branch 'main' into sponsor-model
jvogt23 Nov 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ resume-monitoring.sh
.envault.json
.phpunit.result.cache
/docs/_build/
.DS_Store
15 changes: 15 additions & 0 deletions app/Console/Commands/ImportAllModels.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use App\Models\Attendance;
use App\Models\DuesTransaction;
use App\Models\Event;
use App\Models\Sponsor;
use App\Models\SponsorDomain;
use App\Models\SponsorUser;
use App\Models\Team;
use App\Models\Travel;
use App\Models\TravelAssignment;
Expand Down Expand Up @@ -57,6 +60,18 @@ public function handle(): int
'model' => Event::class,
]);

$this->call('scout:import', [
'model' => Sponsor::class,
]);

$this->call('scout:import', [
'model' => SponsorDomain::class,
]);

$this->call('scout:import', [
'model' => SponsorUser::class,
]);

$this->call('scout:import', [
'model' => Team::class,
]);
Expand Down
14 changes: 14 additions & 0 deletions app/Models/Sponsor.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,18 @@ public function users(): HasMany
{
return $this->hasMany(SponsorUser::class, 'sponsor_id');
}

/**
* Get the indexable data array for the model.
*
* @return array<string,int|string>
*/
public function toSearchableArray(): array
{
$array = $this->toArray();

$array['end_date_unix'] = $this->end_date->getTimestamp();

return $array;
}
}
87 changes: 87 additions & 0 deletions app/Nova/Sponsor.php
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')
->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(),
];
}
}
83 changes: 83 additions & 0 deletions app/Nova/SponsorDomain.php
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)
->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(),
];
}
}
84 changes: 84 additions & 0 deletions app/Nova/SponsorUser.php
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(),
];
}
}
75 changes: 75 additions & 0 deletions app/Policies/SponsorDomainPolicy.php
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;
}
}
Loading