PHP code example of arkitecht / laravel-attributions

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

    

arkitecht / laravel-attributions example snippets


use Arkitecht\Attributions\Database\Schema\Blueprint;

/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    $schema =  DB::getSchemaBuilder();

    $schema->blueprintResolver(function($table, $callback) {
        return new Blueprint($table, $callback);
    });

    $schema->create('tests', function (Blueprint $table) {
        $table->increments('id');
        $table->timestamps();
        $table->attributions();
    });
}

class CreateTestsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tests', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->attributions();
        });
    }
	
	...

}

class CreateTestsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tests', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->attributions('employees','employee_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('tests');
    }
}



namespace App;

use Arkitecht\Attributions\Traits\Attributions;
use Illuminate\Database\Eloquent\Model;

class Test extends Model
{
    use Attributions;
}