mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
Merge branch 'develop'
This commit is contained in:
commit
9d0303f787
@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use Laravel\Jetstream\HasProfilePhoto;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
@ -71,6 +72,11 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
return $this->belongsTo(UserRole::class, 'user_role_id');
|
||||
}
|
||||
|
||||
public function isAdmin(): bool
|
||||
{
|
||||
return Str::lower($this->role->name) === 'administrator';
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
@ -19,6 +21,9 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
// This gate determines who can access the Pulse dashboard.
|
||||
Gate::define('viewPulse', function (User $user) {
|
||||
return $user->isAdmin();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Horizon\Horizon;
|
||||
use Laravel\Horizon\HorizonApplicationServiceProvider;
|
||||
|
||||
class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
@ -28,9 +27,7 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
protected function gate(): void
|
||||
{
|
||||
Gate::define('viewHorizon', function ($user) {
|
||||
return in_array($user->email, [
|
||||
//
|
||||
]);
|
||||
return $user->isAdmin();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,16 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
||||
Nova::withBreadcrumbs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tools that should be listed in the Nova sidebar.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function tools()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Nova routes.
|
||||
*
|
||||
@ -33,6 +43,16 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
||||
->register();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Nova gate.
|
||||
*
|
||||
@ -43,9 +63,7 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
||||
protected function gate()
|
||||
{
|
||||
Gate::define('viewNova', function ($user) {
|
||||
return in_array($user->email, [
|
||||
//
|
||||
]);
|
||||
return $user->isAdmin();
|
||||
});
|
||||
}
|
||||
|
||||
@ -60,24 +78,4 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
||||
new \App\Nova\Dashboards\Main,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tools that should be listed in the Nova sidebar.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function tools()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,9 @@
|
||||
{
|
||||
"name": "laravel/laravel",
|
||||
"name": "sp-tarkov/forge",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"framework"
|
||||
],
|
||||
"license": "MIT",
|
||||
"description": "A Laravel-based web application that provides a platform for the Single Player Tarkov community to share and discover user-generated content, such as mods, guides, and other tools.",
|
||||
"keywords": [],
|
||||
"license": "MPL-2.0",
|
||||
"require": {
|
||||
"php": "^8.3",
|
||||
"ext-curl": "*",
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "html",
|
||||
"name": "forge",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
@ -2,12 +2,18 @@ import "./bootstrap";
|
||||
|
||||
import.meta.glob(["../video/**"]);
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const themeToggleIcon = {
|
||||
dark: document.getElementById("theme-toggle-dark-icon"),
|
||||
light: document.getElementById("theme-toggle-light-icon"),
|
||||
light: document.getElementById("theme-toggle-light-icon")
|
||||
};
|
||||
|
||||
// Make sure the theme toggle icons are available.
|
||||
if (themeToggleIcon.dark === null || themeToggleIcon.light === null) {
|
||||
console.log("Theme toggle icons not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Function to update the visibility of the theme icons based on the theme
|
||||
function updateIconVisibility(theme) {
|
||||
if (theme === "dark") {
|
||||
@ -41,7 +47,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
// Set up the theme toggle button
|
||||
const themeToggleBtn = document.getElementById("theme-toggle");
|
||||
themeToggleBtn.addEventListener("click", function () {
|
||||
themeToggleBtn.addEventListener("click", function() {
|
||||
// Determine the current theme by checking the classList of documentElement
|
||||
const currentTheme = document.documentElement.classList.contains("dark") ? "dark" : "light";
|
||||
const newTheme = currentTheme === "light" ? "dark" : "light";
|
||||
|
3
resources/js/bootstrap.js
vendored
3
resources/js/bootstrap.js
vendored
@ -1,4 +1,7 @@
|
||||
import { Livewire } from "../../vendor/livewire/livewire/dist/livewire.esm";
|
||||
import axios from "axios";
|
||||
|
||||
Livewire.start();
|
||||
|
||||
window.axios = axios;
|
||||
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
||||
|
@ -56,6 +56,6 @@
|
||||
@livewire('global-search')
|
||||
@stack('modals')
|
||||
|
||||
@livewireScripts
|
||||
@livewireScriptConfig
|
||||
</body>
|
||||
</html>
|
||||
|
@ -11,6 +11,8 @@
|
||||
<link href="//fonts.bunny.net" rel="preconnect">
|
||||
<link href="//fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet">
|
||||
|
||||
<link href="{{ config('app.asset_url') }}" rel="dns-prefetch">
|
||||
|
||||
<script>
|
||||
// Immediately set the theme to prevent a flash of the default theme when another is set.
|
||||
// Must be located inline, in the head, and before any CSS is loaded.
|
||||
@ -33,7 +35,6 @@
|
||||
{{ $slot }}
|
||||
</div>
|
||||
|
||||
@livewireScripts
|
||||
|
||||
@livewireScriptConfig
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user