Unverified Commit f3fee52a authored by ruchit-viitorcloud's avatar ruchit-viitorcloud Committed by GitHub

Merge branch 'master' into master

parents 952e30e3 a4956390
......@@ -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;
}
......
......@@ -155,7 +155,7 @@ class BlogsController extends Controller
if (is_numeric($tag)) {
$tags_array[] = $tag;
} else {
$newTag = BlogTag::create(['name'=>$tag, 'status'=>1, 'created_by'=>1]);
$newTag = BlogTag::create(['name' => $tag, 'status' => 1, 'created_by' => 1]);
$tags_array[] = $newTag->id;
}
}
......
......@@ -26,7 +26,7 @@ class VerifyJWTToken
} elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
return response()->json(['token_invalid'], $e->getStatusCode());
} else {
return response()->json(['error'=>'Token is required']);
return response()->json(['error' => 'Token is required']);
}
}
......
......@@ -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
......
......@@ -101,7 +101,7 @@ abstract class Notification
*/
public function setOptions(array $options)
{
foreach ($options as $optionKey=>$option) {
foreach ($options as $optionKey => $option) {
$methodName = 'set'.ucfirst($optionKey);
$propertyName = '_'.$optionKey;
if (method_exists($methodName, $this)) {
......
......@@ -91,7 +91,7 @@ class SendEmail
break;
}
// Send email code
$message = ['data'=>$content];
$message = ['data' => $content];
return Mail::send(['html' => 'emails.template'], $message, function ($message) use ($data) {
$message->to($data['to']);
......
......@@ -4,6 +4,7 @@ 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;
......@@ -12,7 +13,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/
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>';
}
}
......@@ -6,6 +6,7 @@ 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;
......@@ -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>';
}
......
......@@ -4,14 +4,18 @@ 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;
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>';
}
}
......@@ -4,14 +4,18 @@ 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;
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>';
}
}
......@@ -4,14 +4,18 @@ 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;
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>';
}
}
......@@ -3,13 +3,17 @@
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;
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>';
}
}
......@@ -3,13 +3,17 @@
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;
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>';
}
}
......@@ -3,12 +3,17 @@
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;
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>';
}
......
......@@ -3,13 +3,17 @@
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;
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>';
}
}
}
......@@ -53,7 +53,7 @@ class PasswordResetRepository extends BaseRepository
*/
public function update($attributes)
{
$token = ['token'=>$attributes['token']];
$token = ['token' => $attributes['token']];
return $this->query()->where('email', $attributes['email'])->update($attributes);
}
......
......@@ -57,7 +57,7 @@ class UserRepository extends BaseRepository
*/
public function resetpassword($data)
{
$pass = ['password'=>bcrypt($data['password'])];
$pass = ['password' => bcrypt($data['password'])];
return $this->query()->where('email', $data['email'])->update($pass);
}
......@@ -72,13 +72,13 @@ class UserRepository extends BaseRepository
return $this->query()
->select('first_name', 'last_name', 'email', 'address', 'country_id', 'state_id', 'city_id', 'zip_code', 'ssn', 'status', 'created_at', 'updated_at')
->where('id', $id)
->with(['country'=> function ($query) {
->with(['country' => function ($query) {
$query->select('id', 'country');
}])
->with(['state'=> function ($query) {
->with(['state' => function ($query) {
$query->select('id', 'state');
}])
->with(['city'=> function ($query) {
->with(['city' => function ($query) {
$query->select('id', 'city');
}])
->get()
......@@ -150,7 +150,7 @@ class UserRepository extends BaseRepository
**/
public function confirmUser($email)
{
$confirmed = ['confirmed'=>'1'];
$confirmed = ['confirmed' => '1'];
return $this->query()->where('email', $email)->update($confirmed);
}
......
......@@ -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