shared dashboards
This commit is contained in:
@ -16,7 +16,6 @@ class CreateDashboardsTable extends Migration
|
||||
Schema::create('dashboards', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('company_id');
|
||||
$table->integer('user_id');
|
||||
$table->string('name');
|
||||
$table->boolean('enabled')->default(1);
|
||||
$table->timestamps();
|
||||
@ -25,6 +24,14 @@ class CreateDashboardsTable extends Migration
|
||||
$table->index(['company_id']);
|
||||
});
|
||||
|
||||
Schema::create('user_dashboards', function (Blueprint $table) {
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->integer('dashboard_id')->unsigned();
|
||||
$table->string('user_type', 20);
|
||||
|
||||
$table->primary(['user_id', 'dashboard_id', 'user_type']);
|
||||
});
|
||||
|
||||
Schema::create('widgets', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('company_id');
|
||||
@ -36,7 +43,7 @@ class CreateDashboardsTable extends Migration
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['company_id']);
|
||||
$table->index(['company_id', 'dashboard_id']);
|
||||
});
|
||||
}
|
||||
|
||||
@ -48,6 +55,7 @@ class CreateDashboardsTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('dashboards');
|
||||
Schema::drop('user_dashboards');
|
||||
Schema::drop('widgets');
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,10 @@
|
||||
namespace Database\Seeds;
|
||||
|
||||
use App\Abstracts\Model;
|
||||
use App\Models\Auth\User;
|
||||
use App\Models\Common\Widget;
|
||||
use App\Models\Common\Dashboard;
|
||||
use App\Utilities\Widgets as WidgetUtility;
|
||||
use App\Utilities\Widgets;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class Dashboards extends Seeder
|
||||
@ -31,12 +32,11 @@ class Dashboards extends Seeder
|
||||
|
||||
$dashboard = Dashboard::create([
|
||||
'company_id' => $company_id,
|
||||
'user_id' => $user_id,
|
||||
'name' => trans('general.dashboard'),
|
||||
'name' => trans_choice('general.dashboards', 1),
|
||||
'enabled' => 1,
|
||||
]);
|
||||
|
||||
$widgets = WidgetUtility::getClasses(false);
|
||||
$widgets = Widgets::getClasses(false);
|
||||
|
||||
$sort = 1;
|
||||
|
||||
@ -52,5 +52,7 @@ class Dashboards extends Seeder
|
||||
|
||||
$sort++;
|
||||
}
|
||||
|
||||
User::find($user_id)->dashboards()->attach($dashboard->id);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ class Roles extends Seeder
|
||||
'banking-transactions' => 'c,r,u,d',
|
||||
'banking-transfers' => 'c,r,u,d',
|
||||
'common-companies' => 'c,r,u,d',
|
||||
'common-dashboards' => 'c,r,u,d',
|
||||
'common-import' => 'c',
|
||||
'common-items' => 'c,r,u,d',
|
||||
'common-notifications' => 'c,r,u,d',
|
||||
@ -98,13 +99,14 @@ class Roles extends Seeder
|
||||
'banking-transactions' => 'c,r,u,d',
|
||||
'banking-transfers' => 'c,r,u,d',
|
||||
'common-companies' => 'c,r,u,d',
|
||||
'common-dashboards' => 'c,r,u,d',
|
||||
'common-import' => 'c',
|
||||
'common-items' => 'c,r,u,d',
|
||||
'common-notifications' => 'c,r,u,d',
|
||||
'common-reports' => 'c,r,u,d',
|
||||
'common-search' => 'r',
|
||||
'common-uploads' => 'r',
|
||||
'common-widgets' => 'r',
|
||||
'common-widgets' => 'c,r,u,d',
|
||||
'purchases-bills' => 'c,r,u,d',
|
||||
'purchases-payments' => 'c,r,u,d',
|
||||
'purchases-vendors' => 'c,r,u,d',
|
||||
|
Reference in New Issue
Block a user