Skip to content
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

added configuration #3

Merged
merged 2 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ We believe in backwards compatability just as much as Trongate, below are the su
composer require shitware-ltd/laravel-trongate
```

## Configuration

We understand that the default countdown of `5` seconds and `1` second delay before redirect might not suit your needs.

To fix this, publish the configuration file and modify just to your needs!

```bash
php artisan vendor:publish --provider="ShitwareLtd\LaravelTrongate\TrongateServiceProvider" --tag="config"
```

## License

MIT
Expand Down
8 changes: 7 additions & 1 deletion src/TrongateServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ class TrongateServiceProvider extends ServiceProvider
{
public function register()
{

$this->mergeConfigFrom(__DIR__.'./config/trongate.php', 'trongate');
}

public function boot(Kernel $kernel)
{
$this->loadViewsFrom(__DIR__.'/resources/views', 'trongate');
$kernel->pushMiddleware(TrongateMiddleware::class);

if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/config/trongate.php' => config_path('trongate.php'),
], 'config');
}
}
}
26 changes: 26 additions & 0 deletions src/config/trongate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Countdown
|--------------------------------------------------------------------------
|
| Who doesn't love a good ol' countdown? Specify the time (in seconds)
| we should be counting down before redirection delay hits.
|
*/
'countdown' => 5,

/*
|--------------------------------------------------------------------------
| Delay before redirection
|--------------------------------------------------------------------------
|
| Bask in the glory of Trongate for just a while longer before
jorqensen marked this conversation as resolved.
Show resolved Hide resolved
| redirecting the visitor. Specify the time (in seconds) before the
| redirect will occur.
|
*/
'redirect_delay' => 1,
jorqensen marked this conversation as resolved.
Show resolved Hide resolved
];
8 changes: 7 additions & 1 deletion src/resources/views/trongate.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<h1>You've made a <u>huge</u> mistake for using Laravel.</h1>
<h2>Use Trongate!</h2>

<p>You will be redirected in <span _="on load set $timer to 5 repeat 5 times decrement $timer then put it into my innerHTML wait 1s end then go to url 'https://trongate.io'">5</span> seconds.</p>
<p>
You will be redirected in
<span _="on load set $timer to {{ config('trongate.countdown') }} repeat {{ config('trongate.countdown') }} times decrement $timer then put it into my innerHTML wait {{ config('trongate.redirect_delay') }}s end then go to url 'https://trongate.io'">
jorqensen marked this conversation as resolved.
Show resolved Hide resolved
{{ config('trongate.countdown') }}
</span>
seconds.
</p>
</body>
</html>