PHP code example of yusufalper / laravel-order

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

    

yusufalper / laravel-order example snippets


use Illuminate\Database\Eloquent\Model;
use Alper\LaravelOrder\Traits\HasOrder;

class CompanyBranch extends Model
{
    use HasOrder;
    
    protected $fillable = [
        'order'
        'company_id'
    ];

    public string $orderAttrName = 'order';
    
    public array $orderUnificationAttributes = [
        'company_id'
    ];
}


use Illuminate\Database\Eloquent\Model;
use Alper\LaravelOrder\Traits\HasOrder;

class CompanyBranch extends Model
{
    use HasOrder {
        HasOrder::boot as bootHasOrderTrait;
    }
    use OtherTrait {
        OtherTrait::boot as bootOtherTraitTrait;
    }

    public static function boot(): void
    {
        static::bootHasOrderTrait();
        static::bootOtherTraitTrait();
    }
    
    protected $fillable = [
        'order'
        'company_id'
    ];
    
    public string $orderAttrName = 'order';

    public array $orderUnificationAttributes = [
        'company_id'
    ];
}