Unverified Commit 0e316be3 authored by Viral Solani's avatar Viral Solani Committed by GitHub

Merge pull request #17 from bvipul/vs_master_trait_change

Added Model Master trait file and done related changes in each module
parents 893dae21 5ce27ecd
......@@ -17,8 +17,9 @@ trait AttributeClass
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">'.
//call your attribute functions here
'</div>';
return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute(editPermission, editRoute).'
'.$this->getDeleteButtonAttribute(deletePermission, deleteRoute).'
</div>';
}
}
......@@ -2,14 +2,18 @@
namespace DummyNamespace;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use DummyAttribute;
use DummyRelationship;
class DummyModel extends Model
{
use AttributeName,
RelationshipName;
use ModelTrait,
AttributeName,
RelationshipName {
// AttributeName::getEditButtonAttribute insteadof ModelTrait;
}
/**
* NOTE : If you want to implement Soft Deletes in this model,
......
......@@ -45,6 +45,7 @@ class DummyRepoName extends BaseRepository
public function create(array $input)
{
$dummy_small_model_name = self::MODEL;
$dummy_small_model_name = new $dummy_small_model_name();
if ($dummy_small_model_name->save($input)) {
return true;
}
......
......@@ -106,6 +106,22 @@ class Generator
protected $update_permission;
protected $delete_permission;
/**
* Routes
* 1. Edit Route
* 2. Store Route
* 3. Manage Route
* 4. Create Route
* 5. Update Route
* 6. Delete Route.
*/
protected $edit_route;
protected $store_route;
protected $index_route;
protected $create_route;
protected $update_route;
protected $delete_route;
/**
* Repository
* 1. Repository Name
......@@ -206,6 +222,14 @@ class Generator
$this->update_permission = 'update-'.strtolower(str_singular($this->model));
$this->delete_permission = 'delete-'.strtolower(str_singular($this->model));
//Routes
$this->index_route = 'admin.'.strtolower(str_plural($this->model)).'.index';
$this->create_route = 'admin.'.strtolower(str_plural($this->model)).'.create';
$this->store_route = 'admin.'.strtolower(str_plural($this->model)).'.store';
$this->edit_route = 'admin.'.strtolower(str_plural($this->model)).'.edit';
$this->update_route = 'admin.'.strtolower(str_plural($this->model)).'.update';
$this->delete_route = 'admin.'.strtolower(str_plural($this->model)).'.destroy';
//Events
$this->events = array_filter($input['event']);
......@@ -342,11 +366,15 @@ class Generator
*/
public function createModel()
{
$this->createDirectory($this->getBasePath($this->attribute_namespace));
$this->createDirectory($this->getBasePath($this->removeFileNameFromEndOfNamespace($this->attribute_namespace)));
//Generate Attribute File
$this->generateFile('Attribute', [
'AttributeNamespace' => ucfirst($this->removeFileNameFromEndOfNamespace($this->attribute_namespace)),
'AttributeClass' => $this->attribute,
'editPermission' => $this->edit_permission,
'editRoute' => $this->edit_route,
'deletePermission' => $this->delete_permission,
'deleteRoute' => $this->delete_route
], lcfirst($this->attribute_namespace));
//Generate Relationship File
......
......@@ -2,17 +2,23 @@
namespace App\Models\Access\Permission;
use App\Models\Access\Permission\Traits\Attribute\PermissionAttribute;
use App\Models\Access\Permission\Traits\Relationship\PermissionRelationship;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Access\Permission\Traits\Attribute\PermissionAttribute;
use App\Models\Access\Permission\Traits\Relationship\PermissionRelationship;
/**
* Class Permission.
*/
class Permission extends Model
{
use PermissionRelationship, PermissionAttribute, SoftDeletes;
use ModelTrait,
SoftDeletes,
PermissionAttribute,
PermissionRelationship {
// PermissionAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
......
......@@ -7,42 +7,14 @@ namespace App\Models\Access\Permission\Traits\Attribute;
*/
trait PermissionAttribute
{
/**
* @return string
*/
public function getEditButtonAttribute()
{
if (access()->allow('edit-permission')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.access.permission.edit', $this).'">
<i data-toggle="tooltip" data-placement="top" title="Edit" class="fa fa-pencil"></i>
</a>';
}
}
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-permission')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.access.permission.destroy', $this).'" data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'"
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'"
data-trans-title="'.trans('strings.backend.general.are_you_sure').'">
<i data-toggle="tooltip" data-placement="top" title="Delete" class="fa fa-trash"></i>
</a>';
}
}
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute().'
'.$this->getDeleteButtonAttribute().'
'.$this->getEditButtonAttribute('edit-permission', 'admin.access.permission.edit').'
'.$this->getDeleteButtonAttribute('delete-permission', 'admin.access.permission.destroy').'
</div>';
}
}
......@@ -2,12 +2,13 @@
namespace App\Models\Access\Role;
use App\Models\Access\Role\Traits\Attribute\RoleAttribute;
use App\Models\Access\Role\Traits\Relationship\RoleRelationship;
use App\Models\Access\Role\Traits\RoleAccess;
use App\Models\Access\Role\Traits\Scope\RoleScope;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Access\Role\Traits\RoleAccess;
use App\Models\Access\Role\Traits\Scope\RoleScope;
use App\Models\Access\Role\Traits\Attribute\RoleAttribute;
use App\Models\Access\Role\Traits\Relationship\RoleRelationship;
/**
* Class Role.
......@@ -15,10 +16,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class Role extends Model
{
use RoleScope,
ModelTrait,
RoleAccess,
RoleAttribute,
RoleRelationship,
SoftDeletes;
SoftDeletes {
RoleAttribute::getEditButtonAttribute insteadof ModelTrait;
RoleAttribute::getDeleteButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
......
......@@ -43,7 +43,7 @@ trait RoleAttribute
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute().'
'.$this->getEditButtonAttribute('edit-role', 'admin.access.role.edit').'
'.$this->getDeleteButtonAttribute().'
</div>';
}
......
......@@ -2,14 +2,14 @@
namespace App\Models\Access\User;
use App\Models\Access\User\Traits\Attribute\UserAttribute;
use App\Models\Access\User\Traits\Relationship\UserRelationship;
use App\Models\Access\User\Traits\Scope\UserScope;
use App\Models\Access\User\Traits\UserAccess;
use App\Models\Access\User\Traits\UserSendPasswordReset;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Access\User\Traits\UserAccess;
use App\Models\Access\User\Traits\Scope\UserScope;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use App\Models\Access\User\Traits\UserSendPasswordReset;
use App\Models\Access\User\Traits\Attribute\UserAttribute;
use App\Models\Access\User\Traits\Relationship\UserRelationship;
/**
* Class User.
......
......@@ -2,16 +2,20 @@
namespace App\Models\BlogCategories;
use App\Models\BlogCategories\Traits\Attribute\BlogCategoryAttribute;
use App\Models\BlogCategories\Traits\Relationship\BlogCategoryRelationship;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\BlogCategories\Traits\Attribute\BlogCategoryAttribute;
use App\Models\BlogCategories\Traits\Relationship\BlogCategoryRelationship;
class BlogCategory extends Model
{
use BlogCategoryAttribute,
use ModelTrait,
SoftDeletes,
BlogCategoryRelationship;
BlogCategoryAttribute,
BlogCategoryRelationship {
// BlogCategoryAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
......
......@@ -7,41 +7,14 @@ namespace App\Models\BlogCategories\Traits\Attribute;
*/
trait BlogCategoryAttribute
{
/**
* @return string
*/
public function getEditButtonAttribute()
{
if (access()->allow('edit-blog-category')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.blogcategories.edit', $this).'">
<i data-toggle="tooltip" data-placement="top" title="'.trans('buttons.general.crud.edit').'" class="fa fa-pencil"></i>
</a>';
}
}
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-blog-category')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.blogcategories.destroy', $this).'" data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'"
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'"
data-trans-title="'.trans('strings.backend.general.are_you_sure').'">
<i data-toggle="tooltip" data-placement="top" title="Delete" class="fa fa-trash"></i>
</a>';
}
}
/**
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute().'
'.$this->getDeleteButtonAttribute().'
'.$this->getEditButtonAttribute('edit-blog-category', 'admin.blogcategories.edit').'
'.$this->getDeleteButtonAttribute('delete-blog-category', 'admin.blogcategories.destroy').'
</div>';
}
}
......@@ -2,16 +2,20 @@
namespace App\Models\BlogTags;
use App\Models\BlogTags\Traits\Attribute\BlogTagAttribute;
use App\Models\BlogTags\Traits\Relationship\BlogTagRelationship;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\BlogTags\Traits\Attribute\BlogTagAttribute;
use App\Models\BlogTags\Traits\Relationship\BlogTagRelationship;
class BlogTag extends Model
{
use BlogTagAttribute,
use ModelTrait,
SoftDeletes,
BlogTagRelationship;
BlogTagAttribute,
BlogTagRelationship{
// BlogTagAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
......
......@@ -7,41 +7,14 @@ namespace App\Models\BlogTags\Traits\Attribute;
*/
trait BlogTagAttribute
{
/**
* @return string
*/
public function getEditButtonAttribute()
{
if (access()->allow('edit-blog-tag')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.blogtags.edit', $this).'">
<i data-toggle="tooltip" data-placement="top" title="'.trans('buttons.general.crud.edit').'" class="fa fa-pencil"></i>
</a>';
}
}
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-blog-tag')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.blogtags.destroy', $this).'" data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'"
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'"
data-trans-title="'.trans('strings.backend.general.are_you_sure').'">
<i data-toggle="tooltip" data-placement="top" title="'.trans('buttons.general.crud.delete').'" class="fa fa-trash"></i>
</a>';
}
}
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute().'
'.$this->getDeleteButtonAttribute().'
'.$this->getEditButtonAttribute('edit-blog-tag', 'admin.blogtags.edit').'
'.$this->getDeleteButtonAttribute('delete-blog-tag', 'admin.blogtags.destroy').'
</div>';
}
}
......@@ -2,16 +2,20 @@
namespace App\Models\Blogs;
use App\Models\Blogs\Traits\Attribute\BlogAttribute;
use App\Models\Blogs\Traits\Relationship\BlogRelationship;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Blogs\Traits\Attribute\BlogAttribute;
use App\Models\Blogs\Traits\Relationship\BlogRelationship;
class Blog extends Model
{
use BlogAttribute,
BlogRelationship,
SoftDeletes;
use ModelTrait,
SoftDeletes,
BlogAttribute,
BlogRelationship {
// BlogAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
......
......@@ -7,42 +7,14 @@ namespace App\Models\Blogs\Traits\Attribute;
*/
trait BlogAttribute
{
/**
* @return string
*/
public function getEditButtonAttribute()
{
if (access()->allow('edit-blog')) {
return '<a href="'.route('admin.blogs.edit', $this).'" class="btn btn-flat btn-default">
<i data-toggle="tooltip" data-placement="top" title="Edit" class="fa fa-pencil"></i>
</a>';
}
}
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-blog')) {
return '<a href="'.route('admin.blogs.destroy', $this).'"
class="btn btn-flat btn-default" data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'"
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'"
data-trans-title="'.trans('strings.backend.general.are_you_sure').'">
<i data-toggle="tooltip" data-placement="top" title="Delete" class="fa fa-trash"></i>
</a>';
}
}
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">'.
$this->getEditButtonAttribute().
$this->getDeleteButtonAttribute().
$this->getEditButtonAttribute('edit-blog', 'admin.blogs.edit').
$this->getDeleteButtonAttribute('delete-blog', 'admin.blogs.destroy').
'</div>';
}
}
......@@ -2,14 +2,18 @@
namespace App\Models\CMSPages;
use App\Models\CMSPages\Traits\Attribute\CMSPageAttribute;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\CMSPages\Traits\Attribute\CMSPageAttribute;
class CMSPage extends Model
{
use CMSPageAttribute,
SoftDeletes;
use ModelTrait,
SoftDeletes,
CMSPageAttribute {
// CMSPageAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
......
......@@ -7,41 +7,14 @@ namespace App\Models\CMSPages\Traits\Attribute;
*/
trait CMSPageAttribute
{
/**
* @return string
*/
public function getEditButtonAttribute()
{
if (access()->allow('edit-cms-pages')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.cmspages.edit', $this).'">
<i data-toggle="tooltip" data-placement="top" title="'.trans('buttons.general.crud.edit').'" class="fa fa-pencil"></i>
</a>';
}
}
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-cms-pages')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.cmspages.destroy', $this).'" data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'"
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'"
data-trans-title="'.trans('strings.backend.general.are_you_sure').'">
<i data-toggle="tooltip" data-placement="top" title="Delete" class="fa fa-trash"></i>
</a>';
}
}
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute().'
'.$this->getDeleteButtonAttribute().'
'.$this->getEditButtonAttribute('edit-cms-pages', 'admin.cmspages.edit').'
'.$this->getDeleteButtonAttribute('delete-cms-pages', 'admin.cmspages.destroy').'
</div>';
}
}
......@@ -2,14 +2,18 @@
namespace App\Models\EmailTemplates;
use App\Models\EmailTemplates\Traits\Attribute\EmailTemplateAttribute;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\EmailTemplates\Traits\Attribute\EmailTemplateAttribute;
class EmailTemplate extends Model
{
use EmailTemplateAttribute,
SoftDeletes;
use ModelTrait,
SoftDeletes,
EmailTemplateAttribute {
// EmailTemplateAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
......
......@@ -7,36 +7,11 @@ namespace App\Models\EmailTemplates\Traits\Attribute;
*/
trait EmailTemplateAttribute
{
/**
* @return string
*/
public function getEditButtonAttribute()
{
if (access()->allow('edit-email-template')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.emailtemplates.edit', $this).'" class="btn btn-xs btn-primary"><i class="fa fa-pencil" data-toggle="tooltip" data-placement="top" title="'.trans('buttons.general.crud.edit').'"></i></a> ';
}
}
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-email-template')) {
return '<a href="'.route('admin.emailtemplates.destroy', $this).'"
data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'"
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'"
data-trans-title="'.trans('strings.backend.general.are_you_sure').'"
class="btn btn-xs btn-danger"><i class="fa fa-times" data-toggle="tooltip" data-placement="top" title="'.trans('buttons.general.crud.delete').'"></i></a>';
}
}
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">'.$this->getEditButtonAttribute().'</div>';
return '<div class="btn-group action-btn">'.$this->getEditButtonAttribute('edit-email-template', 'admin.emailtemplates.edit').'</div>';
}
}
......@@ -2,13 +2,18 @@
namespace App\Models\Faqs;
use App\Models\Faqs\Traits\Attribute\FaqAttribute;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Faqs\Traits\Attribute\FaqAttribute;
class Faq extends Model
{
use FaqAttribute, SoftDeletes;
use ModelTrait,
SoftDeletes,
FaqAttribute {
// FaqAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
......
......@@ -7,34 +7,6 @@ namespace App\Models\Faqs\Traits\Attribute;
*/
trait FaqAttribute
{
/**
* @return string
*/
public function getEditButtonAttribute()
{
if (access()->allow('edit-faq')) {
return '<a href="'.route('admin.faqs.edit', $this).'" class="btn btn-flat btn-default">
<i data-toggle="tooltip" data-placement="top" title="Edit" class="fa fa-pencil"></i>
</a>';
}
}
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-faq')) {
return '<a href="'.route('admin.faqs.destroy', $this).'"
class="btn btn-flat btn-default" data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'"
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'"
data-trans-title="'.trans('strings.backend.general.are_you_sure').'">
<i data-toggle="tooltip" data-placement="top" title="Delete" class="fa fa-trash"></i>
</a>';
}
}
/**
* @return string
*/
......@@ -83,8 +55,8 @@ trait FaqAttribute
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">'.
$this->getEditButtonAttribute().
$this->getDeleteButtonAttribute().
$this->getEditButtonAttribute('edit-faq', 'admin.faqs.edit').
$this->getDeleteButtonAttribute('delete-faq', 'admin.faqs.destroy').
$this->getStatusButtonAttribute().
'</div>';
}
......
......@@ -2,14 +2,18 @@
namespace App\Models\Menu;
use App\Models\Menu\Traits\Attribute\MenuAttribute;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Menu\Traits\Attribute\MenuAttribute;
class Menu extends Model
{
use MenuAttribute,
SoftDeletes;
use ModelTrait,
SoftDeletes,
MenuAttribute {
// MenuAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
......
......@@ -7,41 +7,14 @@ namespace App\Models\Menu\Traits\Attribute;
*/
trait MenuAttribute
{
/**
* @return string
*/
public function getEditButtonAttribute()
{
if (access()->allow('edit-menu')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.menus.edit', $this).'">
<i data-toggle="tooltip" data-placement="top" title="'.trans('buttons.general.crud.edit').'" class="fa fa-pencil"></i>
</a>';
}
}
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-menu')) {
return '<a class="btn btn-flat btn-default" href="'.route('admin.menus.destroy', $this).'" data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'"
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'"
data-trans-title="'.trans('strings.backend.general.are_you_sure').'">
<i data-toggle="tooltip" data-placement="top" title="Delete" class="fa fa-trash"></i>
</a>';
}
}
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute().'
'.$this->getDeleteButtonAttribute().'
'.$this->getEditButtonAttribute('edit-menu', 'admin.menus.edit').'
'.$this->getDeleteButtonAttribute('delete-menu', 'admin.menus.destroy').'
</div>';
}
}
<?php
namespace App\Models;
trait ModelTrait {
/**
* @return string
*/
public function getEditButtonAttribute($permission, $route)
{
if (access()->allow($permission)) {
return '<a href="'.route($route, $this).'" class="btn btn-flat btn-default">
<i data-toggle="tooltip" data-placement="top" title="Edit" class="fa fa-pencil"></i>
</a>';
}
}
/**
* @return string
*/
public function getDeleteButtonAttribute($permission, $route)
{
if (access()->allow($permission)) {
return '<a href="'.route($route, $this).'"
class="btn btn-flat btn-default" data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'"
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'"
data-trans-title="'.trans('strings.backend.general.are_you_sure').'">
<i data-toggle="tooltip" data-placement="top" title="Delete" class="fa fa-trash"></i>
</a>';
}
}
}
\ No newline at end of file
......@@ -53,7 +53,7 @@ class RoleRepository extends BaseRepository
DB::raw("GROUP_CONCAT( DISTINCT permissions.display_name SEPARATOR '<br/>') as permission_name"),
DB::raw('(SELECT COUNT(role_user.id) FROM role_user LEFT JOIN users ON role_user.user_id = users.id WHERE role_user.role_id = roles.id AND users.deleted_at IS NULL) AS userCount'),
])
->groupBy('roles.id');
->groupBy(config('access.roles_table').'.id', config('access.roles_table').'.name', config('access.roles_table').'.all', config('access.roles_table').'.sort');
}
/**
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment