1. Go to this page and download the library: Download enriquejlicona/dhosa 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/ */
enriquejlicona / dhosa example snippets
namespace App\Models;
// ...
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravie\Dhosa\Concerns\Swappable;
class User extends Authenticatable
{
use Swappable;
/**
* Get Hot-swappable alias name.
*
* @return string
*/
public static function hsAliasName(): string
{
return 'User';
}
}
use Laravie\Dhosa\HotSwap;
HotSwap::register('Orchestra\Model\User');
use Laravie\Dhosa\HotSwap;
HotSwap::override('User', 'App\User');
use Orchestra\Model\User;
/* ... */
public function user()
{
return $this->belongsTo(User::hsFinder());
}
use Orchestra\Model\User;
$user = User::hs(); // return instance of App\User
$user = User::hs()->query(); // return a query builder for App\User
$user = User::hsOn('api'); // return a query builder for App\User using `api` db connection.
$user = User::hsOnWriteConnection(); // return a query builder for App\User using write PDO connection.
use Orchestra\Model\Role;
use Orchestra\Model\User;
User::hsAliasName(); // return "User"
User::hsFinder(); // return "App\User"
Role::hsFinder(); // return "Orchestra\Model\Role"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.