PHP code example of naabster / laravel-eloquent-hashids
1. Go to this page and download the library: Download naabster/laravel-eloquent-hashids 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/ */
naabster / laravel-eloquent-hashids example snippets
use Illuminate\Database\Eloquent\Model;
use Naabster\EloquentHashids\EloquentHashids;
class Book extends Model
{
use EloquentHashids;
// Rest of your eloquent model
}
use Illuminate\Database\Eloquent\Model;
use Naabster\EloquentHashids\EloquentHashids;
class Book extends Model
{
use EloquentHashids;
public static function getHashidConnection(Model $model)
{
return 'someconnection';
}
}
use Illuminate\Database\Eloquent\Model;
use Naabster\EloquentHashids\EloquentHashids;
class Book extends Model
{
use EloquentHashids;
public static function getHashidColumn(Model $model)
{
return 'hashid';
}
}
use Illuminate\Database\Eloquent\Model;
use Naabster\EloquentHashids\EloquentHashids;
class Book extends Model
{
use EloquentHashids;
public static function getHashidEncodingValue(Model $model)
{
return $model->myId;
}
}
use Illuminate\Database\Eloquent\Model;
use Naabster\EloquentHashids\EloquentHashids;
class Book extends Model
{
use EloquentHashids;
public static function getHashidConnection(Model $model)
{
return 'bookHashids';
}
public static function getHashidColumn(Model $model)
{
return 'hashid';
}
public static function getHashidEncodingValue(Model $model)
{
return [$model->id, $model->foreign_key];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.