1. Go to this page and download the library: Download lioneagle/le-utils 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/ */
lioneagle / le-utils example snippets
namespace Lioneagle\LeUtils\Tests\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Lioneagle\LeUtils\Contracts\Uuidable;
use Lioneagle\LeUtils\Traits\HasUuid;
class User extends Model implements Uuidable
{
use HasUuid;
protected $fillable = ['name'];
public function posts(): HasMany
{
return $this->hasMany(Post::class);
}
}
namespace Lioneagle\LeUtils\Query;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Lioneagle\LeUtils\Contracts\UuidBuilderInterface;
use Lioneagle\LeUtils\Traits\BuilderUuidScope;
class CustomBuilder extends EloquentBuilder implements UuidBuilderInterface
{
use BuilderUuidScope;
public function whereActive()
{
return $this->where('active', 1);
}
}
class User extends Model implements Uuidable
{
use HasUuid;
protected $fillable = ['name'];
public function posts(): HasMany
{
return $this->hasMany(Post::class);
}
public function newEloquentBuilder($query): UuidBuilderInterface
{
return new CustomBuilder($query);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.