Skip to content
Open
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.log
/.phpunit.cache
/node_modules
/public/build
Expand Down
18 changes: 4 additions & 14 deletions app/Console/Commands/ConfirmationEmails.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,17 @@

use App\Mail\RetreatConfirmation;
use Carbon\Carbon;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Mail\Mailer;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;

#[Signature('email:confirmations')]
#[Description('Send out confirmation emails one week prior to start date for Ignatian retreats')]
class ConfirmationEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'email:confirmations';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Send out confirmation emails one week prior to start date for Ignatian retreats';

protected $mailer;

/**
Expand Down
578 changes: 281 additions & 297 deletions app/Console/Commands/GetMailgunMessages.php

Large diffs are not rendered by default.

18 changes: 4 additions & 14 deletions app/Console/Commands/ImportStripePayouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,15 @@
use App\Models\StripeBalanceTransaction;
use App\Models\StripePayout;
use Carbon\Carbon;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Stripe\StripeClient;

#[Signature('import:stripe_payouts')]
#[Description('Import Stripe Payouts')]
class ImportStripePayouts extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'import:stripe_payouts';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Import Stripe Payouts';

/**
* Create a new command instance.
*
Expand Down
18 changes: 4 additions & 14 deletions app/Console/Commands/PostRetreatEmails.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,15 @@
use App\Mail\PostRetreat;
use App\Models\Retreat;
use Carbon\Carbon;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;

#[Signature('email:post-retreat')]
#[Description('Send out post retreat emails.')]
class PostRetreatEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'email:post-retreat';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Send out post retreat emails.';

/**
* Create a new command instance.
*
Expand Down
18 changes: 4 additions & 14 deletions app/Console/Commands/SendBirthdays.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,16 @@
use App\Mail\RetreatantBirthday;
use App\Models\Contact;
use Carbon\Carbon;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;

#[Signature('email:birthdays')]
#[Description('Sends out birthday emails to retreatants with birthdays of current day.')]
class SendBirthdays extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'email:birthdays';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Sends out birthday emails to retreatants with birthdays of current day.';

/**
* Create a new command instance.
*
Expand Down
28 changes: 11 additions & 17 deletions app/Http/Controllers/ActivityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,20 @@
use App\Http\Requests\UpdateActivityRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Controllers\HasMiddleware;
use Illuminate\Support\Facades\Gate;
use Illuminate\Routing\Attributes\Controllers\Authorize;
use Illuminate\Routing\Attributes\Controllers\Middleware;
use Illuminate\Support\Facades\Redirect;
use Illuminate\View\View;

class ActivityController extends Controller implements HasMiddleware
#[Middleware('auth')]
class ActivityController extends Controller
{
public static function middleware(): array
{
return [
'auth',
];
}

/**
* Display a listing of the resource.
*/
#[Authorize('show-activity')]
public function index(): View
{
Gate::authorize('show-activity');
$activities = \App\Models\Activity::orderBy('activity_date_time', 'desc')->paginate(25, ['*'], 'activities');

return view('activities.index', compact('activities'));
Expand All @@ -34,9 +28,9 @@ public function index(): View
/**
* Show the form for creating a new resource.
*/
#[Authorize('create-activity')]
public function create(Request $request): View
{
Gate::authorize('create-activity');
$staff = \App\Models\Contact::with('groups')->whereHas('groups', function ($query) {
$query->where('group_id', '=', config('polanco.group_id.staff'));
})->orderBy('sort_name')->pluck('sort_name', 'id');
Expand Down Expand Up @@ -64,9 +58,9 @@ public function create(Request $request): View
/**
* Store a newly created resource in storage.
*/
#[Authorize('create-activity')]
public function store(StoreActivityRequest $request): RedirectResponse
{
Gate::authorize('create-activity');
$activity_type = \App\Models\ActivityType::findOrFail($request->input('activity_type_id'));
$activity = new \App\Models\Activity;
$activity->activity_type_id = $request->input('activity_type_id');
Expand Down Expand Up @@ -105,9 +99,9 @@ public function store(StoreActivityRequest $request): RedirectResponse
/**
* Display the specified resource.
*/
#[Authorize('show-activity')]
public function show(int $id): View
{
Gate::authorize('show-activity');
$activity = \App\Models\Activity::with('assignees', 'creators', 'targets')->findOrFail($id);

return view('activities.show', compact('activity')); //
Expand All @@ -116,9 +110,9 @@ public function show(int $id): View
/**
* Show the form for editing the specified resource.
*/
#[Authorize('update-activity')]
public function edit(int $id): View
{
Gate::authorize('update-activity');
$activity = \App\Models\Activity::findOrFail($id);
$target = $activity->targets->first();
$assignee = $activity->assignees->first();
Expand Down Expand Up @@ -151,9 +145,9 @@ public function edit(int $id): View
/**
* Update the specified resource in storage.
*/
#[Authorize('update-activity')]
public function update(UpdateActivityRequest $request, int $id): RedirectResponse
{
Gate::authorize('update-activity');
$activity_type = \App\Models\ActivityType::findOrFail($request->input('activity_type_id'));
$activity = \App\Models\Activity::findOrFail($id);

Expand Down Expand Up @@ -187,11 +181,11 @@ public function update(UpdateActivityRequest $request, int $id): RedirectRespons
/**
* Remove the specified resource from storage.
*/
#[Authorize('delete-activity')]
public function destroy(int $id): RedirectResponse
{
// delete activity contacts and then the activity (could be handled in model with cascading deletes)

Gate::authorize('delete-activity');
\App\Models\ActivityContact::whereActivityId($id)->delete();
\App\Models\Activity::destroy($id);

Expand Down
29 changes: 11 additions & 18 deletions app/Http/Controllers/AddressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use App\Http\Requests\UpdateAddressRequest;
use App\Models\Address;
use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Controllers\HasMiddleware;
use Illuminate\Support\Facades\Gate;
use Illuminate\Routing\Attributes\Controllers\Authorize;
use Illuminate\Routing\Attributes\Controllers\Middleware;
use Illuminate\Support\Facades\Redirect;
use Illuminate\View\View;

Expand All @@ -16,21 +16,15 @@
* In testing, the address controller uses CRUD-style permissions which are theoretical rather than the contact CRUD permissions used in production
* In other words, in production, the create-contact permission is used rather than create-address.
*/
class AddressController extends Controller implements HasMiddleware
#[Middleware('auth')]
class AddressController extends Controller
{
public static function middleware(): array
{
return [
'auth',
];
}

/**
* Display a listing of the resource.
*/
#[Authorize('show-address')]
public function index(): View
{
Gate::authorize('show-address');
$addresses = \App\Models\Address::orderBy('postal_code', 'asc')->with('addressee')->paginate(25, ['*'], 'addresses');

return view('addresses.index', compact('addresses'));
Expand All @@ -39,9 +33,9 @@ public function index(): View
/**
* Show the form for creating a new resource.
*/
#[Authorize('create-address')]
public function create(): View
{
Gate::authorize('create-address');
$countries = \App\Models\Country::orderBy('iso_code')->pluck('iso_code', 'id');
$countries->prepend('N/A', '');
$states = \App\Models\StateProvince::orderBy('name')->whereCountryId(config('polanco.country_id_usa'))->pluck('name', 'id');
Expand All @@ -55,9 +49,9 @@ public function create(): View
/**
* Store a newly created resource in storage.
*/
#[Authorize('create-address')]
public function store(StoreAddressRequest $request): RedirectResponse
{
Gate::authorize('create-address');
$address = new \App\Models\Address;
$address->contact_id = $request->input('contact_id');
$address->location_type_id = $request->input('location_type_id');
Expand All @@ -78,9 +72,9 @@ public function store(StoreAddressRequest $request): RedirectResponse
/**
* Display the specified resource.
*/
#[Authorize('show-address')]
public function show(int $id): View
{
Gate::authorize('show-address');
$address = \App\Models\Address::with('addressee')->findOrFail($id);

return view('addresses.show', compact('address'));
Expand All @@ -89,10 +83,9 @@ public function show(int $id): View
/**
* Show the form for editing the specified resource.
*/
#[Authorize('update-address')]
public function edit(int $id): View
{
Gate::authorize('update-address');

$countries = \App\Models\Country::orderBy('iso_code')->pluck('iso_code', 'id');
$countries->prepend('N/A', '');
$states = \App\Models\StateProvince::orderBy('name')->whereCountryId(config('polanco.country_id_usa'))->pluck('name', 'id');
Expand All @@ -107,9 +100,9 @@ public function edit(int $id): View
/**
* Update the specified resource in storage.
*/
#[Authorize('update-address')]
public function update(UpdateAddressRequest $request, int $id): RedirectResponse
{
Gate::authorize('update-address');
$address = \App\Models\Address::findOrFail($id);
$address->contact_id = $request->input('contact_id');
$address->location_type_id = $request->input('location_type_id');
Expand All @@ -130,9 +123,9 @@ public function update(UpdateAddressRequest $request, int $id): RedirectResponse
/**
* Remove the specified resource from storage.
*/
#[Authorize('delete-address')]
public function destroy(int $id): RedirectResponse
{
Gate::authorize('delete-address');
$address = \App\Models\Address::findOrFail($id);
$contact_id = $address->contact_id;
\App\Models\Address::destroy($id);
Expand Down
Loading