Answer the question
In order to leave comments, you need to log in
How to implement complex query in laravel?
Tell me how I can implement the output of pages by priority.
There are tables.
Schema::create('pages', function (Blueprint $table) {
$table->increments('id');
$table->integer('category')->unsigned();
$table->integer('status')->unsigned();
$table->integer('priority')->unsigned();
$table->timestamps();
});
Schema::create('pages_status', function (Blueprint $table) {
$table->increments('id');
$table->integer('priority')->unsigned();
$table->string('name', 60);
});
Schema::create('pages_priority', function (Blueprint $table) {
$table->increments('id');
$table->integer('priority')->unsigned();
$table->string('name', 60);
});
Schema::create('pages_category', function (Blueprint $table) {
$table->increments('id');
$table->integer('priority')->unsigned();
$table->string('name', 60);
});
Schema::table('pages', function(Blueprint $table) {
$table->foreign('status')->references('id')->on('pages_status')
->onDelete('restrict')
->onUpdate('restrict');
$table->foreign('priority')->references('id')->on('pages_priority')
->onDelete('restrict')
->onUpdate('restrict');
$table->foreign('category')->references('id')->on('pages_category')
->onDelete('restrict')
->onUpdate('restrict');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question