1. Go to this page and download the library: Download devanoxltd/core 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/ */
devanoxltd / core example snippets
use Devanox\Core\Http\Middleware\PreventAccessFromCentralDomains;
use Illuminate\Support\Facades\Route;
// ...
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
then: function () {
if (file_exists(base_path('routes/tenant.php'))) {
Route::middleware([
'web',
PreventAccessFromCentralDomains::class,
])
->name('tenant.')
->group(base_path('routes/tenant.php'));
}
}
)
namespace App\Models;
use Devanox\Core\Models\Tenant as BaseTenant;
class Tenant extends BaseTenant
{
// Add custom relationships or logic here
public function users()
{
return $this->hasMany(User::class);
}
}
use App\Models\Tenant;
$tenant = Tenant::find(1);
tenancy()->run($tenant, function ($tenant) {
// This code will run within the context of the tenant
// e.g., using the tenant's database connection
});