-
Notifications
You must be signed in to change notification settings - Fork 2
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
happyhack
committed
Oct 14, 2018
0 parents
commit e44c6e8
Showing
191 changed files
with
175,448 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_size = 2 |
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,48 @@ | ||
APP_NAME=Laravel-Admin-Template | ||
APP_ENV=local | ||
APP_KEY=base64:/qIaOFE= | ||
APP_DEBUG=true | ||
APP_URL=http://localhost | ||
|
||
LOG_CHANNEL=stack | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=3306 | ||
DB_DATABASE=db_name | ||
DB_USERNAME=root | ||
DB_PASSWORD=root | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=files | ||
QUEUE_CONNECTION=sync | ||
SESSION_DRIVER=files | ||
SESSION_LIFETIME=120 | ||
|
||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_DRIVER=smtp | ||
MAIL_HOST=smtp.qq.com | ||
MAIL_PORT=465 | ||
MAIL_USERNAME=no-reply@happyhack.cn | ||
MAIL_PASSWORD= | ||
MAIL_ENCRYPTION=ssl | ||
MAIL_FROM_ADDRESS=no-reply@happyhack.cn | ||
MAIL_FROM_NAME=happyhack | ||
|
||
PUSHER_APP_ID= | ||
PUSHER_APP_KEY= | ||
PUSHER_APP_SECRET= | ||
PUSHER_APP_CLUSTER=mt1 | ||
|
||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" | ||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" | ||
|
||
ADMIN_SKIN=skin-purple-light | ||
APP_SMALL_NAME=LAT | ||
#侧边栏默认展开 sidebar-collapse | ||
APP_SIDEBAR= | ||
APP_VERSION=1.0 | ||
DEFAULT_PASSWORD=666666 |
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,5 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.scss linguist-vendored | ||
*.js linguist-vendored | ||
CHANGELOG.md export-ignore |
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,18 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
/.idea | ||
/.vscode | ||
/.vagrant | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
.env | ||
.phpunit.result.cache | ||
.idea | ||
_ide_helper.php | ||
_ide_helper_models.php | ||
.phpstorm.meta.php |
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,42 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire') | ||
// ->hourly(); | ||
} | ||
|
||
/** | ||
* Register the commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
$this->load(__DIR__.'/Commands'); | ||
|
||
require base_path('routes/console.php'); | ||
} | ||
} |
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,48 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use App\Models\User; | ||
use Illuminate\Broadcasting\Channel; | ||
use Illuminate\Queue\SerializesModels; | ||
use Illuminate\Broadcasting\PrivateChannel; | ||
use Illuminate\Broadcasting\PresenceChannel; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | ||
|
||
class UserLogin | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** | ||
* @var User | ||
*/ | ||
public $user; | ||
|
||
/** | ||
* @var | ||
*/ | ||
public $ip; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct (User $user, String $ip) | ||
{ | ||
$this->user = $user; | ||
$this->ip = $ip; | ||
} | ||
|
||
/** | ||
* Get the channels the event should broadcast on. | ||
* | ||
* @return \Illuminate\Broadcasting\Channel|array | ||
*/ | ||
public function broadcastOn () | ||
{ | ||
return new PrivateChannel('channel-name'); | ||
} | ||
} |
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,51 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Exception; | ||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that are not reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
// | ||
]; | ||
|
||
/** | ||
* A list of the inputs that are never flashed for validation exceptions. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontFlash = [ | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* @param \Exception $exception | ||
* @return void | ||
*/ | ||
public function report(Exception $exception) | ||
{ | ||
parent::report($exception); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $exception | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $exception) | ||
{ | ||
return parent::render($request, $exception); | ||
} | ||
} |
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 App\Models\User; | ||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
|
||
class HomeController extends Controller | ||
{ | ||
public function index () | ||
{ | ||
$users = User::count(); | ||
$orders = '66,342'; | ||
$checking_orders = '7,053'; | ||
$done_orders = '2,000'; | ||
return view('admin.dashbord',compact('users','orders','checking_orders','done_orders')); | ||
} | ||
} |
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,78 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
|
||
use App\Http\Requests\AddPermission; | ||
use App\Http\Requests\AddRole; | ||
use App\Http\Controllers\Controller; | ||
use App\Http\Requests\PostRole; | ||
use App\Models\User; | ||
use Illuminate\Support\Facades\Auth; | ||
use Spatie\Permission\Models\Permission; | ||
use Spatie\Permission\Models\Role; | ||
|
||
class RoleController extends Controller | ||
{ | ||
/** | ||
* @desc 权限分页数据 | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function permissions () | ||
{ | ||
$permissions = Permission::with('users')->paginate(10); | ||
|
||
return $this->successResponseData(200, $permissions); | ||
} | ||
|
||
/** | ||
* @desc 角色分页数据 | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function roles () | ||
{ | ||
$roles = Role::with('users')->paginate(10); | ||
|
||
return $this->successResponseData(200, $roles); | ||
} | ||
|
||
/** | ||
* @desc 添加角色 | ||
* @param AddRole $role | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function addRole (AddRole $role) | ||
{ | ||
return Role::create($role->only('name')) ? $this->successResponseData() : $this->errorResponseData(); | ||
} | ||
|
||
/** | ||
* @desc 添加权限 | ||
* @param AddPermission $permission | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function addPermission (AddPermission $permission) | ||
{ | ||
return Permission::create($permission->only('name')) ? $this->successResponseData() : $this->errorResponseData(); | ||
} | ||
|
||
|
||
/** | ||
* 更新用户角色 | ||
* @param PostRole $request | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function syncPermissionByUser (User $user, PostRole $request) | ||
{ | ||
return $user->syncPermissions($request->get('data')) ? $this->successResponseData(200, __('success')) : $this->errorResponseData(); | ||
} | ||
|
||
/** | ||
* 更新用户权限 | ||
* @param PostRole $postRole | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function syncRoleByUser (User $user, PostRole $postRole) | ||
{ | ||
return $user->syncRoles($postRole->get('data')) ? $this->successResponseData(200, __('success')) : $this->errorResponseData(); | ||
} | ||
} |
Oops, something went wrong.