Skip to content

Commit

Permalink
Merge pull request #39 from starfolksoftware/fix/bugs-and-patches
Browse files Browse the repository at this point in the history
fix: tiny fixes
  • Loading branch information
frknasir authored Apr 27, 2023
2 parents 0493acf + c388af5 commit 40072ad
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 56 deletions.
5 changes: 5 additions & 0 deletions config/tithe.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
return [
'ignores_routes' => false,

'routes' => [
'ui' => 'billing',
'admin' => 'tithe',
],

'ignores_migrations' => false,

'favicon' => '',
Expand Down
5 changes: 2 additions & 3 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
use Illuminate\Support\Facades\Route;
use Tithe\Http\Controllers;
use Tithe\Http\Middleware\Authenticate;
use Tithe\Tithe;

Route::middleware(config('tithe.admin_middlewares'))->prefix(Tithe::adminRoutesPrefix())->group(function () {
Route::middleware(config('tithe.admin_middlewares'))->prefix(config('tithe.routes.admin'))->group(function () {
// Login routes...
Route::get('login', [Controllers\AuthenticatedSessionController::class, 'create'])->name('tithe.login');
Route::post('login', [Controllers\AuthenticatedSessionController::class, 'store'])->name('tithe.authenticate');
Expand All @@ -32,7 +31,7 @@
});
});

Route::middleware(config('tithe.ui_middlewares'))->prefix(Tithe::uiRoutesPrefix())->group(function () {
Route::middleware(config('tithe.ui_middlewares'))->prefix(config('tithe.routes.ui'))->group(function () {
Route::get('/', Controllers\BillingController::class)->name('tithe.billing.index');
Route::get('/invoices/{invoiceId}', Controllers\ShowInvoiceController::class)->name('tithe.billing.invoices.show');
Route::get('/create-authorization', Controllers\CreateAuthorizationController::class)->name('tithe.billing.create-authorization');
Expand Down
6 changes: 3 additions & 3 deletions src/Notifications/SubscriptionRenewalFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public function toMail(object $notifiable): MailMessage
$subscriberName = $this->subscriber->titheDisplayName();

return (new MailMessage)
->greeting('Ooops!')
->line("We couldn't renew your subscription for {$subscriberName}. Kindly update your payment method.")
->line('Thank you!');
->greeting('Ooops!')
->line("We couldn't renew your subscription for {$subscriberName}. Kindly update your payment method.")
->line('Thank you!');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Scopes/ExpiringWithGraceDaysScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function apply(Builder $builder, Model $model): void
{
$builder->where(
fn (Builder $query) => $query
->where('expired_at', '>', now())
->orWhere('grace_days_ended_at', '>', now())
->where('expired_at', '>', now())
->orWhere('grace_days_ended_at', '>', now())
);
}

Expand Down
42 changes: 0 additions & 42 deletions src/Tithe.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@ final class Tithe
*/
public static $emailsInvoices = true;

/**
* The default admin routes prefix.
*
* @var string
*/
public static $adminRoutesPrefix = 'tithe';

/**
* The default ui routes prefix.
*
* @var string
*/
public static $uiRoutesPrefix = 'billing';

/**
* The user model table name.
*
Expand Down Expand Up @@ -261,34 +247,6 @@ public static function emailsInvoices(bool $value = true)
return new self();
}

/**
* Sets the default ui routes prefix.
*
* @return static
*/
public static function defaultUiRoutesPrefix(string $prefix)
{
self::$uiRoutesPrefix = $prefix;

return new self();
}

/**
* Returns the default admin routes prefix.
*/
public static function adminRoutesPrefix(): string
{
return self::$adminRoutesPrefix;
}

/**
* Returns the default ui routes prefix.
*/
public static function uiRoutesPrefix(): string
{
return self::$uiRoutesPrefix;
}

/**
* Sets the subscription model's table name.
*
Expand Down
7 changes: 7 additions & 0 deletions stubs/app/Providers/TitheServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,12 @@ public function boot()
Tithe::detachFeaturesFromPlansUsing(TitheActions\DetachFeatureFromPlan::class);
Tithe::createAuthorizationsUsing(TitheActions\CreateAuthorization::class);
Tithe::upgradeSubscriptionsUsing(TitheActions\UpgradeSubscription::class);
Tithe::downgradeSubscriptionsUsing(TitheActions\DowngradeSubscription::class);
Tithe::cancelPendingUpgradesUsing(TitheActions\CancelPendingDowngrade::class);
Tithe::renewSubscriptionsUsing(TitheActions\RenewSubscription::class);
Tithe::getActiveSubscriberUsing(function () {
// edit the following line
return null;
});
}
}
6 changes: 3 additions & 3 deletions tests/AuthenticatedSessionControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

test('login page renders', function () {
$this->get(route('tithe.login'))
->assertSuccessful()
->assertViewIs('tithe::auth.login')
->assertSeeText('Sign in to your account');
->assertSuccessful()
->assertViewIs('tithe::auth.login')
->assertSeeText('Sign in to your account');
});

test('login request will check for invalid emails', function () {
Expand Down
6 changes: 3 additions & 3 deletions tests/NewPasswordControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
$this->get(route('tithe.password.reset', [
'token' => Str::random(60),
]))
->assertSuccessful()
->assertViewIs('tithe::auth.passwords.reset')
->assertSeeText('Reset Password');
->assertSuccessful()
->assertViewIs('tithe::auth.passwords.reset')
->assertSeeText('Reset Password');
});

test('tithe user password can be reset', function () {
Expand Down

0 comments on commit 40072ad

Please sign in to comment.