Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions app/Models/NotificationTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class NotificationTemplate extends Model
'title',
'content',
'channels',
'models',
'disabled',
];

Expand Down Expand Up @@ -83,6 +84,16 @@ public function channels(): Attribute
});
}

/**
* Models this notification can use
*
* @return array $models
*/
public function models(): array
{
return json_decode($this->attributes['models'], true);
}

/**
* Get the rendered HTML content
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function up()
$table->string('title');
$table->text('content');
$table->text('channels')->comment('Stored as json array');
$table->text('models')->comment('Stored as json array');
$table->boolean('disabled')->default(false);
$table->timestamps();
});
Expand Down
15 changes: 11 additions & 4 deletions database/seeders/Standard/NotificationSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
namespace Database\Seeders\Standard;

use App\Models\NotificationTemplate;
use App\Models\Server;
use App\Models\User;
use Illuminate\Database\Seeder;
use phpDocumentor\Reflection\Types\Object_;

class NotificationSeeder extends Seeder
{
Expand All @@ -25,7 +28,8 @@ public function run()
<p>This dashboard can be used to create and delete servers.<br /> These servers can be used and managed on our pterodactyl panel.<br /> If you have any questions, please join our Discord server and #create-a-ticket.</p>
<p>We hope you can enjoy this hosting experience and if you have any suggestions please let us know!</p>
<p>Regards,<br />Controlpanel</p>",
'channels' => json_encode(['mail'])
'channels' => json_encode(['mail']),
'models' => json_encode([User::class]),
]);

NotificationTemplate::query()->firstOrCreate([
Expand All @@ -36,7 +40,8 @@ public function run()
'content' => "
<p>Hello <strong>{{\$user->username}}</strong>, Your Mail settings are configured correctly!</p>
<p>Regards,<br />Controlpanel</p>",
'channels' => json_encode(['mail'])
'channels' => json_encode(['mail']),
'models' => json_encode([User::class]),
]);

NotificationTemplate::query()->firstOrCreate([
Expand All @@ -50,7 +55,8 @@ public function run()
Please recharge your account to continue using our services.
</p>
<p>Regards,<br />Controlpanel</p>",
'channels' => json_encode(['mail'])
'channels' => json_encode(['mail']),
'models' => json_encode([User::class]),
]);

NotificationTemplate::query()->firstOrCreate([
Expand All @@ -64,7 +70,8 @@ public function run()
You can now use your servers again.
</p>
<p>Regards,<br />Controlpanel</p>",
'channels' => json_encode(['mail'])
'channels' => json_encode(['mail']),
'models' => json_encode([User::class]),
]);
}
}
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@
"A voucher is expired at and after this date": "A voucher is expired at and after this date",
"Voucher saved": "Voucher saved",
"Voucher removed": "Voucher removed",
"Used / Uses": "Used / Uses"
"Used / Uses": "Used / Uses",

"Example": "Example"
}
18 changes: 18 additions & 0 deletions lang/en/blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Blade Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used in blade files for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/

'notification.models' => 'Hover over the following button below to view the available variables to use.',

];
24 changes: 22 additions & 2 deletions resources/views/admin/notifications/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,29 @@
<button name="submit" type="submit" class="btn btn-primary">{{__('Submit')}}</button>
</div>
</form>

</div>

<br />
<div class="card card-body border-0 shadow table-wrapper table-responsive d-inline-flex">
<div class="row">
@foreach(json_decode($notification->models) as $a => $item)
<div class="col-sm-6">
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">{{class_basename(new $item())}}</h5>
<h6 class="card-subtitle mb-2 text-muted">{{ __('Example') }} &lbrace;&lbrace;${{strtolower(class_basename(new $item()))}}->id&rbrace;&rbrace;</h6>
<p class="card-text">{{ __('blade.notification.models') }}</p>
<button type="button" class="btn btn-gray-700 fas fa-info-circle" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-html="true" title="
@foreach((new $item())->getFillable() as $b => $value)
{{preg_replace('/\s+/', ' ', $value)}}
<br/>
@endforeach">
</button>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
@endsection

Expand Down
8 changes: 2 additions & 6 deletions resources/views/checkout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
@include("layouts.parts.customization")

<!-- Custom Headerscripts -->
<script src="{{ asset("js/".$custom_js_filename) }}"></script>


@stack('headerScripts')

<!-- Sweet alert 2 -->
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
Expand All @@ -32,9 +30,7 @@
<nav class="navbar navbar-expand-sm navbar-transparent navbar-dark navbar-theme-primary mb-4">
<div class="container position-relative">
<a class="navbar-brand me-lg-5" href="{{ route('home') }}">
@if (file_exists(storage_path("app/public/images/".$settings->custom_icon_filename)) && !is_null($settings->custom_icon_filename))
<img src="{{asset("storage/images/".$settings->custom_icon_filename)}}" height="50" width="50" alt="Logo">
@endif
@stack('customIcon')
</a>
<div class="w-100" id="navbar-default-primary">
<ul class="navbar-nav navbar-nav-hover align-items-lg-center">
Expand Down
7 changes: 7 additions & 0 deletions resources/views/layouts/parts/customization.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
$textcolorrgb = $settings->convert_hex_to_rgb($settings->text_color);
@endphp

@push ('headerScripts')
<script src="{{ asset("js/".$settings->custom_js_filename) }}"></script>
@endpush

@pushIf (file_exists(storage_path("app/public/images/".$settings->custom_icon_filename)) && !is_null($settings->custom_icon_filename), 'customIcon')
<img src="{{asset("storage/images/".$settings->custom_icon_filename)}}" height="50" width="50" alt="Logo">
@endPushIf

<style>
:root {
Expand Down