/** * Do the migration */ public function up() { Capsule::schema()->create('users_permission', function ($table) { $table->increments('id'); $table->integer('group_id'); $table->string('page'); $table->string('action'); $table->timestamps(); }); $array = array(array('group_id' => '1', 'page' => 'user', 'action' => 'index'), array('group_id' => '1', 'page' => 'user', 'action' => 'edit'), array('group_id' => '1', 'page' => 'user', 'action' => 'delete'), array('group_id' => '1', 'page' => 'group', 'action' => 'index'), array('group_id' => '1', 'page' => 'group', 'action' => 'edit'), array('group_id' => '1', 'page' => 'group', 'action' => 'delete'), array('group_id' => '1', 'page' => 'permission', 'action' => 'index'), array('group_id' => '1', 'page' => 'permission', 'action' => 'edit'), array('group_id' => '1', 'page' => 'permission', 'action' => 'delete')); Permission::insert($array); }
public function getPermission($group_id) { $role = UserPermission::where('group_id', $group_id)->get(); if ($role->toArray()) { } }