1. Go to this page and download the library: Download cyclechain/sandboxer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Cyclechain\Sandboxer\Helpers\SandboxAuthHelper;
use Illuminate\Http\Request;
public function login(Request $request)
{
// Handle demo/sandbox login credentials transparently
$sandboxResponse = SandboxAuthHelper::handleSandboxLogin($request, '/dashboard');
if ($sandboxResponse) {
return $sandboxResponse;
}
// Normal application login flow
return parent::login($request);
}
use Cyclechain\Sandboxer\Facades\Sandboxer;
// Check if sandbox mode is active for current request
if (Sandboxer::isActive()) {
// Current request is sandboxed
}
// Get the current sandbox session UUID
$sandboxId = Sandboxer::currentId();
// Manually destroy current sandbox session and clear storage
app(\Cyclechain\Sandboxer\SandboxManager::class)->destroy();
use Illuminate\Support\Facades\Schedule;
use Cyclechain\Sandboxer\Jobs\SandboxCleanupJob;
Schedule::job(new SandboxCleanupJob())->hourly();