|
|
@@ -0,0 +1,70 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+use Illuminate\Database\Migrations\Migration;
|
|
|
+use Illuminate\Database\Schema\Blueprint;
|
|
|
+use Illuminate\Support\Facades\Schema;
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
+
|
|
|
+class InsertSampleReportIntoDatatablesTable extends Migration
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * Run the migrations.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function up()
|
|
|
+ {
|
|
|
+ DB::table('datatables')->insert([
|
|
|
+ 'id' => 1,
|
|
|
+ 'name' => 'Employee-Report',
|
|
|
+ 'description' => null,
|
|
|
+ 'base_table' => 'employees',
|
|
|
+ 'select_columns' => json_encode([
|
|
|
+ ['select_exp' => 'employees.name AS employee_name'],
|
|
|
+ ['select_exp' => 'employees.email AS employee_email'],
|
|
|
+ ['select_exp' => 'employees.position AS employee_position'],
|
|
|
+ ['select_exp' => 'offices.name AS office_name'],
|
|
|
+ ['select_exp' => 'offices.location AS office_location']
|
|
|
+ ]),
|
|
|
+ 'joins' => json_encode([
|
|
|
+ [
|
|
|
+ 'type' => 'inner',
|
|
|
+ 'table' => 'offices',
|
|
|
+ 'on' => [
|
|
|
+ 'first' => 'employees.office_id',
|
|
|
+ 'operator' => '=',
|
|
|
+ 'second' => 'offices.id'
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ ]),
|
|
|
+ 'conditions' => null,
|
|
|
+ 'default_sorting' => json_encode([
|
|
|
+ ['name' => 'employees.name', 'dir' => 'asc']
|
|
|
+ ]),
|
|
|
+ 'created_at' => null,
|
|
|
+ 'updated_at' => null,
|
|
|
+ 'enable_copy' => 1,
|
|
|
+ 'enable_csv' => 1,
|
|
|
+ 'enable_excel' => 0,
|
|
|
+ 'enable_pdf' => 1,
|
|
|
+ 'enable_print' => 1,
|
|
|
+ 'columns_config' => json_encode([
|
|
|
+ ['data' => 'employee_name', 'name' => 'employees.name'],
|
|
|
+ ['data' => 'employee_email', 'name' => 'employees.email'],
|
|
|
+ ['data' => 'employee_position', 'name' => 'employees.position'],
|
|
|
+ ['data' => 'office_name', 'name' => 'offices.name'],
|
|
|
+ ['data' => 'office_location', 'name' => 'offices.location']
|
|
|
+ ])
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Reverse the migrations.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function down()
|
|
|
+ {
|
|
|
+ DB::table('datatables')->where('id', 1)->delete();
|
|
|
+ }
|
|
|
+}
|