Last active
August 29, 2015 14:09
-
-
Save NemoD503/d9949ac51ca0905d90a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# =================================== | |
# Form Field Definitions | |
# =================================== | |
fields: | |
title: | |
label: Название программы | |
span: left | |
price: | |
label: Цена | |
type: number | |
span: right | |
test: | |
label: '123' | |
type: relation | |
nameFrom: fio | |
Reviews: | |
label: Reviews | |
type: relation | |
nameFrom: fio | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Model; | |
/** | |
* Program Model | |
*/ | |
class Program extends Model | |
{ | |
/*.........*/ | |
public $morphMany = [ | |
'Reviews' => ['Cbs\School\Models\Review', 'name' => 'attachable'], | |
]; | |
/*.......*/ | |
} | |
/** | |
* review Model | |
*/ | |
class Review extends Model | |
{ | |
public $morphTo = [ | |
'attachable' => [] | |
]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateProgramsTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('cbs_school_programs', function($table) | |
{ | |
$table->engine = 'InnoDB'; | |
$table->increments('id'); | |
$table->string('title'); | |
$table->string('description')->nullable(); | |
$table->float('price')->nullable(); | |
$table->timestamps(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('cbs_school_programs'); | |
} | |
} | |
class CreateReviewsTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('cbs_school_reviews', function($table) | |
{ | |
$table->engine = 'InnoDB'; | |
$table->increments('id'); | |
$table->string('fio'); | |
$table->integer('account_id'); | |
$table->string('company')->nullable(); | |
$table->string('position')->nullable(); | |
$table->text('text'); | |
$table->date('date')->nullable(); | |
$table->integer('sort')->default('500'); | |
$table->boolean('published')->default('0'); | |
$table->morphs('attachable'); | |
$table->timestamps(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('cbs_school_reviews'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment