PHP code example of inisiatif / common

1. Go to this page and download the library: Download inisiatif/common 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/ */

    

inisiatif / common example snippets


use Inisiatif\Package\Common\Models\Branch;

$branch = Branch::find($id);

use Inisiatif\Package\Common\Concerns\UuidPrimaryKey;

class MyModel extends Model
{
    use UuidPrimaryKey;
}

use Inisiatif\Package\Common\Concerns\HasBranch;

class MyModel extends Model
{
    use HasBranch;
}

use Inisiatif\Package\Common\Abstracts\AbstractRepository;
use Inisiatif\Package\Common\Contracts\ResourceInterface;

class UserRepository extends AbstractRepository
{
    protected $model = User::class;
}

// Model harus implement ResourceInterface
class User extends Model implements ResourceInterface
{
    use UuidPrimaryKey;
}

use Inisiatif\Package\Common\Common;

// Di AppServiceProvider boot method
Common::ignoreMigrations();
bash
php artisan vendor:publish --provider="Inisiatif\Package\Common\Providers\CommonServiceProvider"
bash
composer analyse