-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
314 changed files
with
125,094 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
Homestead.yaml | ||
Homestead.json | ||
.env | ||
/public/uploads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
namespace App\Facades; | ||
use Illuminate\Support\Facades\Facade; | ||
class PermissionFacade extends Facade | ||
{ | ||
protected static function getFacadeAccessor(){ | ||
return 'PermissionRepository'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace App\Facades; | ||
use Illuminate\Support\Facades\Facade; | ||
class UserFacade extends Facade | ||
{ | ||
|
||
protected static function getFacadeAccessor(){ | ||
return 'UserRepository'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
use App\Http\Requests; | ||
use App\Http\Controllers\Controller; | ||
|
||
class IndexController extends Controller | ||
{ | ||
|
||
public function index() | ||
{ | ||
return view('admin.index.index'); | ||
} | ||
|
||
/** | ||
* dataTable 多语言 | ||
* @author 晚黎 | ||
* @date 2016-04-11T14:13:10+0800 | ||
* @return [type] [description] | ||
*/ | ||
public function dataTableI18n() | ||
{ | ||
return trans('pagination.i18n'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
namespace App\Http\Controllers\Admin; | ||
use Illuminate\Http\Request; | ||
use App\Http\Requests; | ||
use App\Http\Controllers\Controller; | ||
use PermissionRepository; | ||
class PermissionController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
return view('admin.permission.list'); | ||
} | ||
|
||
public function ajaxIndex() | ||
{ | ||
$data = PermissionRepository::ajaxIndex(); | ||
return response()->json($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
use Illuminate\Http\Request; | ||
use App\Http\Requests; | ||
use App\Http\Controllers\Controller; | ||
use UserRepository; | ||
class UserController extends Controller | ||
{ | ||
/** | ||
* 用户列表 | ||
* @author 晚黎 | ||
* @date 2016-04-11T16:26:20+0800 | ||
* @return [type] [description] | ||
*/ | ||
public function index() | ||
{ | ||
return view('admin.user.list'); | ||
} | ||
|
||
|
||
public function ajaxIndex() | ||
{ | ||
$data = UserRepository::ajaxIndex(); | ||
return response()->json($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Requests; | ||
use Illuminate\Http\Request; | ||
|
||
class HomeController extends Controller | ||
{ | ||
/** | ||
* Create a new controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->middleware('auth'); | ||
} | ||
|
||
/** | ||
* Show the application dashboard. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index() | ||
{ | ||
return view('home'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
/** | ||
* 权限路由 | ||
*/ | ||
$router->group(['prefix' => 'permission'], function($router){ | ||
$router->get('ajaxindex', 'PermissionController@ajaxIndex'); | ||
}); | ||
|
||
$router->resource('permission', 'PermissionController'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
/** | ||
* 用户路由 | ||
*/ | ||
$router->group(['prefix' => 'user'], function($router){ | ||
$router->get('ajaxindex', 'UserController@ajaxIndex'); | ||
}); | ||
|
||
$router->resource('user', 'UserController'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Menu extends Model | ||
{ | ||
protected $table = 'menus'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Permission extends Model | ||
{ | ||
protected $table = 'permissions'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Role extends Model | ||
{ | ||
protected $table = 'roles'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Providers; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class BackendServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Register the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->app->singleton('UserRepository', function($app){ | ||
return new \App\Repositories\admin\UserRepository(); | ||
}); | ||
|
||
$this->app->singleton('PermissionRepository', function($app){ | ||
return new \App\Repositories\admin\PermissionRepository(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
namespace App\Repositories\admin; | ||
use App\Models\Permission; | ||
use Carbon\Carbon; | ||
/** | ||
* 权限仓库 | ||
*/ | ||
class PermissionRepository | ||
{ | ||
/** | ||
* datatable获取数据 | ||
* @author 晚黎 | ||
* @date 2016-04-11T16:44:40+0800 | ||
* @return [type] [description] | ||
*/ | ||
public function ajaxIndex() | ||
{ | ||
$draw = request('draw', 1);/*获取请求次数*/ | ||
$start = request('start', config('admin.golbal.list.start')); /*获取开始*/ | ||
$length = request('length', config('admin.golbal.list.length')); ///*获取条数*/ | ||
|
||
$search_pattern = request('search.regex', true); /*是否启用模糊搜索*/ | ||
|
||
$name = request('name' ,''); | ||
$slug = request('slug' ,''); | ||
$description = request('description' ,''); | ||
$model = request('model' ,''); | ||
$status = request('status' ,''); | ||
$created_at_from = request('created_at_from' ,''); | ||
$created_at_to = request('created_at_to' ,''); | ||
$updated_at_from = request('updated_at_from' ,''); | ||
$updated_at_to = request('updated_at_to' ,''); | ||
$orders = request('order', []); | ||
|
||
$permission = new Permission; | ||
|
||
/*权限名称搜索*/ | ||
if($name){ | ||
if($search_pattern){ | ||
$permission = $permission->where('name', 'like', $name); | ||
}else{ | ||
$permission = $permission->where('name', $name); | ||
} | ||
} | ||
|
||
/*权限搜索*/ | ||
if($slug){ | ||
if($search_pattern){ | ||
$permission = $permission->where('slug', 'like', $slug); | ||
}else{ | ||
$permission = $permission->where('slug', $slug); | ||
} | ||
} | ||
/*描述搜索*/ | ||
if($description){ | ||
if($search_pattern){ | ||
$permission = $permission->where('description', 'like', $description); | ||
}else{ | ||
$permission = $permission->where('description', $description); | ||
} | ||
} | ||
|
||
/*模型搜索*/ | ||
if($model){ | ||
if($search_pattern){ | ||
$permission = $permission->where('model', 'like', $model); | ||
}else{ | ||
$permission = $permission->where('model', $model); | ||
} | ||
} | ||
|
||
/*状态搜索*/ | ||
if ($status) { | ||
$permission = $permission->where('status', $status); | ||
} | ||
|
||
/*权限创建时间搜索*/ | ||
if($created_at_from){ | ||
$permission = $permission->where('created_at', '>=', getTime($created_at_from)); | ||
} | ||
if($created_at_to){ | ||
$permission = $permission->where('created_at', '<=', getTime($created_at_to, false)); | ||
} | ||
|
||
/*权限修改时间搜索*/ | ||
if($updated_at_from){ | ||
$uafc = new Carbon($updated_at_from); | ||
$permission = $permission->where('created_at', '>=', getTime($updated_at_from)); | ||
} | ||
if($updated_at_to){ | ||
$permission = $permission->where('created_at', '<=', getTime($updated_at_to, false)); | ||
} | ||
|
||
$count = $permission->count(); | ||
|
||
|
||
if($orders){ | ||
$orderName = request('columns.' . request('order.0.column') . '.name'); | ||
$orderDir = request('order.0.dir'); | ||
$permission = $permission->orderBy($orderName, $orderDir); | ||
} | ||
|
||
$permission = $permission->offset($start)->limit($length); | ||
$permissions = $permission->get(); | ||
|
||
// if ($permissions) { | ||
// foreach ($permissions as &$v) { | ||
// $v['actionButton'] = $v->getActionButtonAttribute(); | ||
// } | ||
// } | ||
return [ | ||
'draw' => $draw, | ||
'recordsTotal' => $count, | ||
'recordsFiltered' => $count, | ||
'data' => $permissions, | ||
]; | ||
} | ||
} |
Oops, something went wrong.