Merge branch 'master' of /mnt/git/v2.tiantianxinye.365care

master
songweizong 3 years ago
commit e36b8e5fac

@ -68,7 +68,7 @@ class Admin extends Authenticatable implements Auditable
* @var array
*/
protected $fillable = [
'name', 'username', 'password',
'name', 'username', 'password','project_ids'
];
/**

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin;
use App\Admin;
use App\Forms\AdminForm;
use App\Models\Project;
use Illuminate\Http\Request;
use Kris\LaravelFormBuilder\FormBuilder;
use Spatie\Permission\Models\Role;
@ -19,6 +20,9 @@ class AdminController extends CommonController
public function index(Request $request)
{
$data = $this->model->paginate(20);
foreach ($data as $item) {
$item->projects = Project::whereIn("id", explode(",", $item->project_ids))->get();
}
$roles = (new Role())->where("guard_name", $this->guardName)->get();
return view($this->bladePath . ".index", compact("data", "roles"));

@ -19,6 +19,7 @@
</th>
<th>用户名</th>
<th>角色</th>
<th>项目</th>
<th>操作</th>
</tr>
</thead>
@ -32,6 +33,9 @@
<td class="role-names">
{{ $row->roles ? implode(",",array_column($row->roles->toArray(),"name")) : "" }}
</td>
<td class="role-names">
{{ implode(",",$row->projects->pluck("name")->toArray()) }}
</td>
<td>
<a class="btn btn-sm btn-success"
href="javascript:;" onclick="toggleRoles(this)"><i

Loading…
Cancel
Save