Added casino interface, wallet login, sucessful npm build sucessfull container build
This commit is contained in:
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
FROM php:8.3-fpm
|
||||||
|
|
||||||
|
# Install system dependencies and PHP extensions
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libpq-dev \
|
||||||
|
zip unzip \
|
||||||
|
git \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
|
libicu-dev \
|
||||||
|
libzip-dev \
|
||||||
|
&& docker-php-ext-configure intl \
|
||||||
|
&& docker-php-ext-install pdo pdo_pgsql intl zip \
|
||||||
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install Composer
|
||||||
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
|
# Copy project files
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Set permissions and Git safe directory
|
||||||
|
RUN chown -R www-data:www-data /var/www/html \
|
||||||
|
&& git config --global --add safe.directory /var/www/html
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN composer install --no-dev --optimize-autoloader \
|
||||||
|
&& npm install \
|
||||||
|
&& npm run build
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["php-fpm"]
|
||||||
110
app/Helpers/WalletHelper.php
Normal file
110
app/Helpers/WalletHelper.php
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use App\Models\Wallet;
|
||||||
|
use App\Models\Transaction;
|
||||||
|
use App\Models\AuditLog;
|
||||||
|
|
||||||
|
class WalletHelper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Process a wallet transaction (e.g., deposit, bet) with atomic updates and audit logging.
|
||||||
|
*
|
||||||
|
* @param int $userId
|
||||||
|
* @param float $amount
|
||||||
|
* @param string $type (deposit, bet, win, withdrawal)
|
||||||
|
* @param string|null $description
|
||||||
|
* @param string|null $ipAddress
|
||||||
|
* @return Transaction
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public static function processTransaction($userId, $amount, $type, $description = null, $ipAddress = null)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($userId, $amount, $type, $description, $ipAddress) {
|
||||||
|
// Lock wallet for atomic update
|
||||||
|
$wallet = Wallet::where('user_id', $userId)->lockForUpdate()->firstOrFail();
|
||||||
|
|
||||||
|
// Validate balance for bets/withdrawals
|
||||||
|
if (in_array($type, ['bet', 'withdrawal']) && $wallet->balance < $amount) {
|
||||||
|
throw new \Exception('Insufficient Skunk Coins');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update balance
|
||||||
|
$newBalance = in_array($type, ['bet', 'withdrawal']) ? $wallet->balance - $amount : $wallet->balance + $amount;
|
||||||
|
$wallet->update(['balance' => $newBalance]);
|
||||||
|
|
||||||
|
// Create transaction with SHA-256 hash
|
||||||
|
$hash = hash('sha256', $userId . $amount . $type . time());
|
||||||
|
$transaction = Transaction::create([
|
||||||
|
'wallet_id' => $wallet->id,
|
||||||
|
'amount' => $amount,
|
||||||
|
'type' => $type,
|
||||||
|
'description' => $description,
|
||||||
|
'hash' => $hash,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Log action in audit_logs
|
||||||
|
AuditLog::create([
|
||||||
|
'user_id' => $userId,
|
||||||
|
'action' => 'wallet_' . $type,
|
||||||
|
'details' => json_encode([
|
||||||
|
'wallet_id' => $wallet->id,
|
||||||
|
'amount' => $amount,
|
||||||
|
'new_balance' => $newBalance,
|
||||||
|
'transaction_id' => $transaction->id,
|
||||||
|
]),
|
||||||
|
'ip_address' => $ipAddress,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $transaction;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redeem a promo code for Skunk Coins.
|
||||||
|
*
|
||||||
|
* @param int $userId
|
||||||
|
* @param string $code
|
||||||
|
* @param string|null $ipAddress
|
||||||
|
* @return Transaction
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public static function redeemPromoCode($userId, $code, $ipAddress = null)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($userId, $code, $ipAddress) {
|
||||||
|
$promo = \App\Models\PromoCode::where('code', $code)
|
||||||
|
->where('is_active', true)
|
||||||
|
->where(function ($query) {
|
||||||
|
$query->where('uses_remaining', -1)->orWhere('uses_remaining', '>', 0);
|
||||||
|
})
|
||||||
|
->where(function ($query) {
|
||||||
|
$query->whereNull('expires_at')->orWhere('expires_at', '>', now());
|
||||||
|
})
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
// Check if already redeemed
|
||||||
|
if (\App\Models\PromoCodeRedemption::where('user_id', $userId)->where('promo_code_id', $promo->id)->exists()) {
|
||||||
|
throw new \Exception('Promo code already redeemed');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process deposit
|
||||||
|
$transaction = self::processTransaction($userId, $promo->value, 'deposit', "Promo code: $code", $ipAddress);
|
||||||
|
|
||||||
|
// Record redemption
|
||||||
|
\App\Models\PromoCodeRedemption::create([
|
||||||
|
'promo_code_id' => $promo->id,
|
||||||
|
'user_id' => $userId,
|
||||||
|
'redeemed_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Decrement uses if limited
|
||||||
|
if ($promo->uses_remaining !== -1) {
|
||||||
|
$promo->decrement('uses_remaining');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $transaction;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
71
app/Http/Controllers/LobbyController.php
Normal file
71
app/Http/Controllers/LobbyController.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use App\Models\Wallet;
|
||||||
|
use App\Models\Game;
|
||||||
|
use App\Helpers\WalletHelper;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class LobbyController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$user = auth()->user();
|
||||||
|
return Inertia::render('Lobby', [
|
||||||
|
'wallet' => Wallet::where('user_id', $user->id)->first() ?? ['balance' => 0],
|
||||||
|
'games' => Game::where('is_active', true)->get(),
|
||||||
|
'user' => [
|
||||||
|
'name' => $user->name,
|
||||||
|
'vip_level' => $user->vip_level,
|
||||||
|
'is_kyc_verified' => $user->is_kyc_verified,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addCoins(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate(['amount' => 'required|numeric|min:1']);
|
||||||
|
WalletHelper::processTransaction(auth()->id(), $request->amount, 'deposit', 'Manual coin addition', $request->ip());
|
||||||
|
return Inertia::render('Lobby', [
|
||||||
|
'wallet' => Wallet::where('user_id', auth()->id())->first(),
|
||||||
|
'games' => Game::where('is_active', true)->get(),
|
||||||
|
'user' => [
|
||||||
|
'name' => auth()->user()->name,
|
||||||
|
'vip_level' => auth()->user()->vip_level,
|
||||||
|
'is_kyc_verified' => auth()->user()->is_kyc_verified,
|
||||||
|
],
|
||||||
|
'success' => 'Added ' . $request->amount . ' Skunk Coins',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function redeemPromo(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate(['code' => 'required|string']);
|
||||||
|
try {
|
||||||
|
WalletHelper::redeemPromoCode(auth()->id(), $request->code, $request->ip());
|
||||||
|
return Inertia::render('Lobby', [
|
||||||
|
'wallet' => Wallet::where('user_id', auth()->id())->first(),
|
||||||
|
'games' => Game::where('is_active', true)->get(),
|
||||||
|
'user' => [
|
||||||
|
'name' => auth()->user()->name,
|
||||||
|
'vip_level' => auth()->user()->vip_level,
|
||||||
|
'is_kyc_verified' => auth()->user()->is_kyc_verified,
|
||||||
|
],
|
||||||
|
'success' => 'Promo code redeemed successfully',
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return Inertia::render('Lobby', [
|
||||||
|
'wallet' => Wallet::where('user_id', auth()->id())->first(),
|
||||||
|
'games' => Game::where('is_active', true)->get(),
|
||||||
|
'user' => [
|
||||||
|
'name' => auth()->user()->name,
|
||||||
|
'vip_level' => auth()->user()->vip_level,
|
||||||
|
'is_kyc_verified' => auth()->user()->is_kyc_verified,
|
||||||
|
],
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
42
app/Models/AuditLog.php
Normal file
42
app/Models/AuditLog.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class AuditLog extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'action',
|
||||||
|
'details',
|
||||||
|
'ip_address',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'details' => 'json',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user that owns the audit log.
|
||||||
|
*/
|
||||||
|
public function user(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
33
app/Models/Game.php
Normal file
33
app/Models/Game.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
class Game extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'slug',
|
||||||
|
'thumbnail_url',
|
||||||
|
'category',
|
||||||
|
'is_active',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the player stats for the game.
|
||||||
|
*/
|
||||||
|
public function playerStats(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(PlayerStats::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
70
app/Models/PlayerStats.php
Normal file
70
app/Models/PlayerStats.php
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class PlayerStats extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'game_id',
|
||||||
|
'total_winnings',
|
||||||
|
'total_bets',
|
||||||
|
'play_count',
|
||||||
|
'daily_play_amount',
|
||||||
|
'win_streak',
|
||||||
|
'last_played_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'last_played_at' => 'datetime',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user that owns the stats.
|
||||||
|
*/
|
||||||
|
public function user(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the game for the stats (if per-game).
|
||||||
|
*/
|
||||||
|
public function game(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Game::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom method to update stats after a game play (example).
|
||||||
|
*
|
||||||
|
* @param float $betAmount
|
||||||
|
* @param float $winAmount
|
||||||
|
*/
|
||||||
|
public function updateAfterPlay(float $betAmount, float $winAmount): void
|
||||||
|
{
|
||||||
|
$this->increment('play_count');
|
||||||
|
$this->total_bets += $betAmount;
|
||||||
|
$this->total_winnings += $winAmount;
|
||||||
|
$this->daily_play_amount += $betAmount; // Simplify; use cron for daily reset
|
||||||
|
$this->win_streak = $winAmount > 0 ? $this->win_streak + 1 : 0;
|
||||||
|
$this->last_played_at = now();
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
42
app/Models/PromoCode.php
Normal file
42
app/Models/PromoCode.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
class PromoCode extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'code',
|
||||||
|
'value',
|
||||||
|
'uses_remaining',
|
||||||
|
'expires_at',
|
||||||
|
'is_active',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'expires_at' => 'datetime',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the redemptions for the promo code.
|
||||||
|
*/
|
||||||
|
public function redemptions(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(PromoCodeRedemption::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
48
app/Models/PromoCodeRedemption.php
Normal file
48
app/Models/PromoCodeRedemption.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class PromoCodeRedemption extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'promo_code_id',
|
||||||
|
'user_id',
|
||||||
|
'redeemed_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'redeemed_at' => 'datetime',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the promo code that owns the redemption.
|
||||||
|
*/
|
||||||
|
public function promoCode(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(PromoCode::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user that owns the redemption.
|
||||||
|
*/
|
||||||
|
public function user(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
33
app/Models/Transaction.php
Normal file
33
app/Models/Transaction.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class Transaction extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'wallet_id',
|
||||||
|
'amount',
|
||||||
|
'type',
|
||||||
|
'description',
|
||||||
|
'hash',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the wallet that owns the transaction.
|
||||||
|
*/
|
||||||
|
public function wallet(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Wallet::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
49
app/Models/Wallet.php
Normal file
49
app/Models/Wallet.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
class Wallet extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'balance',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user that owns the wallet.
|
||||||
|
*/
|
||||||
|
public function user(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the transactions for the wallet.
|
||||||
|
*/
|
||||||
|
public function transactions(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Transaction::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom method to get total winnings (derived from transactions).
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getTotalWinningsAttribute(): float
|
||||||
|
{
|
||||||
|
return $this->transactions()->where('type', 'win')->sum('amount');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
|||||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||||
use Illuminate\Session\Middleware\StartSession;
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
|
use Spatie\Permission\Middlewares\RoleMiddleware;
|
||||||
|
|
||||||
class AdminPanelProvider extends PanelProvider
|
class AdminPanelProvider extends PanelProvider
|
||||||
{
|
{
|
||||||
@@ -27,8 +28,10 @@ class AdminPanelProvider extends PanelProvider
|
|||||||
->id('admin')
|
->id('admin')
|
||||||
->path('admin')
|
->path('admin')
|
||||||
->login()
|
->login()
|
||||||
|
->darkMode(true) // Enforce dark theme for casino admin vibe
|
||||||
->colors([
|
->colors([
|
||||||
'primary' => Color::Amber,
|
'primary' => Color::hex('#4CAF50'), // Crypto-green for consistency with lobby
|
||||||
|
'secondary' => Color::hex('#0D1117'), // Dark background to match Stake.com aesthetic
|
||||||
])
|
])
|
||||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
||||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
||||||
@@ -39,6 +42,7 @@ class AdminPanelProvider extends PanelProvider
|
|||||||
->widgets([
|
->widgets([
|
||||||
Widgets\AccountWidget::class,
|
Widgets\AccountWidget::class,
|
||||||
Widgets\FilamentInfoWidget::class,
|
Widgets\FilamentInfoWidget::class,
|
||||||
|
// Add custom widgets later for stats (e.g., user activity, Skunk Coins transactions)
|
||||||
])
|
])
|
||||||
->middleware([
|
->middleware([
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
@@ -53,6 +57,10 @@ class AdminPanelProvider extends PanelProvider
|
|||||||
])
|
])
|
||||||
->authMiddleware([
|
->authMiddleware([
|
||||||
Authenticate::class,
|
Authenticate::class,
|
||||||
]);
|
RoleMiddleware::class . ':admin', // Restrict to admin role via Spatie
|
||||||
|
])
|
||||||
|
->brandName('Skunk Lounge Admin')
|
||||||
|
->brandLogo(asset('images/logo.png')) // Placeholder for custom logo
|
||||||
|
->favicon(asset('images/favicon.ico')); // Placeholder for favicon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
// Test User (Player)
|
// Test User (Player)
|
||||||
$player = User::factory()->create([
|
$player = User::factory()->create([
|
||||||
'name' => 'Test Player',
|
'name' => 'Test Player',
|
||||||
'email' => 'player@example.com',
|
'email' => 'player@skunklounge.com',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'is_kyc_verified' => true,
|
'is_kyc_verified' => true,
|
||||||
'vip_level' => 1,
|
'vip_level' => 1,
|
||||||
@@ -31,7 +31,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
// Test Admin
|
// Test Admin
|
||||||
$admin = User::factory()->create([
|
$admin = User::factory()->create([
|
||||||
'name' => 'Test Admin',
|
'name' => 'Test Admin',
|
||||||
'email' => 'admin@example.com',
|
'email' => 'admin@skunklounge.com',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'is_kyc_verified' => true,
|
'is_kyc_verified' => true,
|
||||||
'vip_level' => 0,
|
'vip_level' => 0,
|
||||||
@@ -39,7 +39,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
$admin->assignRole('admin');
|
$admin->assignRole('admin');
|
||||||
|
|
||||||
// Wallets
|
// Wallets
|
||||||
Wallet::create(['user_id' => $player->id, 'balance' => 1000.00]);
|
Wallet::create(['user_id' => $player->id, 'balance' => 10000.00]);
|
||||||
Wallet::create(['user_id' => $admin->id, 'balance' => 0.00]);
|
Wallet::create(['user_id' => $admin->id, 'balance' => 0.00]);
|
||||||
|
|
||||||
// Games
|
// Games
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
@@ -44,9 +42,11 @@ services:
|
|||||||
working_dir: /var/www/html
|
working_dir: /var/www/html
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www/html
|
- .:/var/www/html
|
||||||
command: npm run dev
|
command: sh -c "npm install && npm run dev"
|
||||||
ports:
|
ports:
|
||||||
- "5173:5173"
|
- "5173:5173"
|
||||||
|
depends_on:
|
||||||
|
- web
|
||||||
networks:
|
networks:
|
||||||
- skunk-net
|
- skunk-net
|
||||||
|
|
||||||
|
|||||||
25
dockerfile
25
dockerfile
@@ -1,25 +0,0 @@
|
|||||||
FROM php:8.3-fpm
|
|
||||||
|
|
||||||
# Install system dependencies
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
libpq-dev \
|
|
||||||
zip unzip \
|
|
||||||
git \
|
|
||||||
nodejs \
|
|
||||||
npm \
|
|
||||||
&& docker-php-ext-install pdo pdo_pgsql
|
|
||||||
|
|
||||||
# Install Composer
|
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /var/www/html
|
|
||||||
|
|
||||||
# Copy project files
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN composer install --no-dev --optimize-autoloader && npm install && npm run build
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
CMD ["php-fpm"]
|
|
||||||
1448
package-lock.json
generated
1448
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@@ -8,12 +8,21 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/vite": "^4.0.0",
|
"@tailwindcss/vite": "^4.0.0",
|
||||||
|
"@inertiajs/vue3": "^1.2.0",
|
||||||
|
"@vitejs/plugin-vue": "^5.1.4",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.6.4",
|
||||||
"concurrently": "^9.0.1",
|
"concurrently": "^9.0.1",
|
||||||
"laravel-vite-plugin": "^2.0.0",
|
"laravel-echo": "^2.2.0",
|
||||||
|
"laravel-vite-plugin": "^1.0",
|
||||||
"postcss": "^8.4.47",
|
"postcss": "^8.4.47",
|
||||||
|
"pusher-js": "^8.4.0",
|
||||||
"tailwindcss": "^3.4.10",
|
"tailwindcss": "^3.4.10",
|
||||||
"vite": "^7.0.4"
|
"vite": "^5.4.8"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"vue": "^3.4.0",
|
||||||
|
"laravel-echo": "^1.15.0",
|
||||||
|
"pusher-js": "^8.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
postcss.config.js
Normal file
6
postcss.config.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export default {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
@import 'tailwindcss';
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
||||||
@source '../../storage/framework/views/*.php';
|
@source '../../storage/framework/views/*.php';
|
||||||
@@ -9,3 +11,7 @@
|
|||||||
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||||
'Segoe UI Symbol', 'Noto Color Emoji';
|
'Segoe UI Symbol', 'Noto Color Emoji';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.game-card:hover {
|
||||||
|
@apply shadow-lg shadow-crypto-green/50;
|
||||||
|
}
|
||||||
82
resources/js/Pages/Lobby.vue
Normal file
82
resources/js/Pages/Lobby.vue
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<template>
|
||||||
|
<div class="min-h-screen">
|
||||||
|
<nav class="bg-gray-800 p-4 flex justify-between">
|
||||||
|
<div class="text-2xl font-bold">Skunk Lounge</div>
|
||||||
|
<div class="space-x-4">
|
||||||
|
<span class="text-crypto-green">{{ user.name }} (VIP Level: {{ user.vip_level }})</span>
|
||||||
|
<span v-if="user.is_kyc_verified" class="text-green-400">KYC Verified</span>
|
||||||
|
<a href="/lobby" class="hover:text-crypto-green">Games</a>
|
||||||
|
<a href="/profile" class="hover:text-crypto-green">Profile</a>
|
||||||
|
<a href="/logout" class="hover:text-crypto-green">Logout</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="p-6">
|
||||||
|
<div v-if="success" class="bg-green-500 p-2 rounded mb-4">{{ success }}</div>
|
||||||
|
<div v-if="error" class="bg-red-500 p-2 rounded mb-4">{{ error }}</div>
|
||||||
|
<div class="bg-gray-800 rounded-lg p-4 mb-6 flex justify-between items-center">
|
||||||
|
<span>Skunk Coins: {{ wallet.balance }}</span>
|
||||||
|
<div class="flex space-x-4">
|
||||||
|
<form @submit.prevent="addCoins">
|
||||||
|
<input v-model="amount" type="number" class="bg-gray-700 p-2 rounded text-white" placeholder="Enter amount">
|
||||||
|
<button type="submit" class="bg-crypto-green hover:bg-green-600 text-white px-4 py-2 rounded ml-2">Add Coins</button>
|
||||||
|
</form>
|
||||||
|
<form @submit.prevent="redeemPromo">
|
||||||
|
<input v-model="promoCode" type="text" class="bg-gray-700 p-2 rounded text-white" placeholder="Promo code">
|
||||||
|
<button type="submit" class="bg-crypto-green hover:bg-green-600 text-white px-4 py-2 rounded ml-2">Redeem</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bg-gray-800 rounded-lg p-4 mb-6">
|
||||||
|
<h3 class="text-lg mb-2">Player Stats</h3>
|
||||||
|
<p>Total Winnings: {{ stats.total_winnings }} Skunk Coins</p>
|
||||||
|
<p>Total Bets: {{ stats.total_bets }} Skunk Coins</p>
|
||||||
|
<p>Play Count: {{ stats.play_count }}</p>
|
||||||
|
<p>Win Streak: {{ stats.win_streak }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||||
|
<div v-for="game in games" :key="game.id" class="bg-gray-800 rounded-lg overflow-hidden transform hover:scale-105 transition game-card">
|
||||||
|
<img :src="game.thumbnail_url" :alt="game.name" class="w-full h-48 object-cover">
|
||||||
|
<div class="p-4">
|
||||||
|
<h3 class="text-lg">{{ game.name }}</h3>
|
||||||
|
<button class="bg-crypto-green hover:bg-green-600 text-white px-4 py-2 rounded mt-2">Play Now</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useForm } from '@inertiajs/vue3'; // Use useForm for Inertia POST requests
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
wallet: Object,
|
||||||
|
games: Array,
|
||||||
|
user: Object,
|
||||||
|
stats: Object,
|
||||||
|
success: String,
|
||||||
|
error: String,
|
||||||
|
});
|
||||||
|
|
||||||
|
const depositForm = useForm({ amount: '' });
|
||||||
|
const promoForm = useForm({ code: '' });
|
||||||
|
|
||||||
|
const addCoins = () => {
|
||||||
|
depositForm.post('/lobby/add-coins', {
|
||||||
|
onSuccess: () => depositForm.reset(),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const redeemPromo = () => {
|
||||||
|
promoForm.post('/lobby/redeem-promo', {
|
||||||
|
onSuccess: () => promoForm.reset(),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.game-card {
|
||||||
|
@apply transition-all duration-300 hover:shadow-lg hover:shadow-crypto-green/50;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1 +1,13 @@
|
|||||||
import './bootstrap';
|
import './bootstrap';
|
||||||
|
import { createApp, h } from 'vue';
|
||||||
|
import { createInertiaApp } from '@inertiajs/vue3';
|
||||||
|
|
||||||
|
createInertiaApp({
|
||||||
|
resolve: name => {
|
||||||
|
const pages = import.meta.glob('./Pages/**/*.vue', { eager: true });
|
||||||
|
return pages[`./Pages/${name}.vue`];
|
||||||
|
},
|
||||||
|
setup({ el, App, props }) {
|
||||||
|
createApp({ render: () => h(App, props) }).mount(el);
|
||||||
|
},
|
||||||
|
});
|
||||||
13
resources/views/app.blade.php
Normal file
13
resources/views/app.blade.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>Skunk Lounge</title>
|
||||||
|
@vite(['resources/js/app.js', 'resources/css/app.css'])
|
||||||
|
@inertiaHead
|
||||||
|
</head>
|
||||||
|
<body class="bg-dark-bg text-white">
|
||||||
|
@inertia
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use App\Http\Controllers\LobbyController;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('welcome');
|
return view('welcome');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::middleware('auth')->group(function () {
|
||||||
|
Route::get('/lobby', [LobbyController::class, 'index'])->name('lobby');
|
||||||
|
Route::post('/lobby/add-coins', [LobbyController::class, 'addCoins'])->name('lobby.add-coins');
|
||||||
|
Route::post('/lobby/redeem-promo', [LobbyController::class, 'redeemPromo'])->name('lobby.redeem-promo');
|
||||||
|
});
|
||||||
17
tailwind.config.js
Normal file
17
tailwind.config.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
content: [
|
||||||
|
'./resources/**/*.blade.php',
|
||||||
|
'./resources/**/*.js',
|
||||||
|
'./resources/**/*.vue',
|
||||||
|
],
|
||||||
|
theme: {
|
||||||
|
extend: {
|
||||||
|
colors: {
|
||||||
|
'crypto-green': '#4CAF50', // For casino vibe
|
||||||
|
'dark-bg': '#0D1117', // Stake.com-like dark theme
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import laravel from 'laravel-vite-plugin';
|
import laravel from 'laravel-vite-plugin';
|
||||||
import tailwindcss from '@tailwindcss/vite';
|
import vue from '@vitejs/plugin-vue';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -8,6 +8,13 @@ export default defineConfig({
|
|||||||
input: ['resources/css/app.css', 'resources/js/app.js'],
|
input: ['resources/css/app.css', 'resources/js/app.js'],
|
||||||
refresh: true,
|
refresh: true,
|
||||||
}),
|
}),
|
||||||
tailwindcss(),
|
vue({
|
||||||
|
template: {
|
||||||
|
transformAssetUrls: {
|
||||||
|
base: null,
|
||||||
|
includeAbsolute: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user