Removed BBS specific branding/info
This commit is contained in:
parent
16757cba02
commit
6027b4c39b
46 changed files with 2035 additions and 138 deletions
32
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
32
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
39
app/Http/Controllers/Auth/LoginController.php
Normal file
39
app/Http/Controllers/Auth/LoginController.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/admin';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
}
|
71
app/Http/Controllers/Auth/RegisterController.php
Normal file
71
app/Http/Controllers/Auth/RegisterController.php
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/register';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'required|string|email|max:255|unique:users',
|
||||
'password' => 'required|string|min:6|confirmed',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => $data['password'],
|
||||
]);
|
||||
}
|
||||
}
|
39
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
39
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
159
app/Http/Controllers/RoleController.php
Normal file
159
app/Http/Controllers/RoleController.php
Normal file
|
@ -0,0 +1,159 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Role;
|
||||
use App\Permission;
|
||||
use App\User;
|
||||
|
||||
class RoleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Enforce middleware
|
||||
*/
|
||||
public function __construct(){
|
||||
$this->middleware(['auth']);
|
||||
$this->middleware(['permissions:CreateRole'], ['only' => ['create','store']]);
|
||||
$this->middleware(['permissions:CreateRole.EditRole.DeleteRole'], ['only' => ['index','show']]);
|
||||
$this->middleware(['permissions:EditRole'], ['only' => ['edit','update']]);
|
||||
$this->middleware(['permissions:DeleteRole'], ['only' => ['destroy']]);
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//Pass all roles
|
||||
$roles=Role::get();
|
||||
return view('roles.index')->with('roles', $roles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$categories=Permission::select('category')->groupBy('category')->get();
|
||||
foreach ($categories as $value){
|
||||
$permissions[$value->category]=Permission::where('category',$value->category)->get();
|
||||
}
|
||||
return view('roles.create')->with('permissions',$permissions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//Validate name and description
|
||||
$this->validate($request, [
|
||||
'name'=>'required|max:120',
|
||||
'description'=>'required|max:3000'
|
||||
]);
|
||||
|
||||
$perms = array();
|
||||
foreach($request->all() as $element => $value){
|
||||
if(preg_match('/p_.*/', $element)){
|
||||
array_push($perms, (int)$value);
|
||||
}
|
||||
}
|
||||
|
||||
$role = Role::create($request->only('name', 'description'));
|
||||
|
||||
$role->permissions()->sync($perms);
|
||||
|
||||
//Redirect to the roles.index view and display message
|
||||
return redirect()->route('roles.index')->with('message','Role successfully added.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//Redirect requests to view specific role to roles index
|
||||
return redirect('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$role = Role::with('permissions')->findOrFail($id);
|
||||
$categories=Permission::select('category')->groupBy('category')->get();
|
||||
foreach ($categories as $value){
|
||||
$permissions[$value->category]=Permission::where('category',$value->category)->get();
|
||||
}
|
||||
$active_perms=array();
|
||||
$active_cats=array();
|
||||
foreach($role->permissions as $perm){
|
||||
array_push($active_perms,$perm->id);
|
||||
array_push($active_cats,$perm->category);
|
||||
}
|
||||
return view('roles.edit')->with('role',$role)->with('permissions',$permissions)->with('active_perms',$active_perms)->with('active_cats',$active_cats);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//Find and update user after validating
|
||||
$role = Role::findOrFail($id);
|
||||
|
||||
$this->validate($request, [
|
||||
'name'=>'required|max:120',
|
||||
'description'=>'required|max:3000'
|
||||
]);
|
||||
|
||||
$perms = array();
|
||||
foreach($request->all() as $element => $value){
|
||||
if(preg_match('/p_.*/', $element)){
|
||||
array_push($perms, (int)$value);
|
||||
}
|
||||
}
|
||||
|
||||
$update = $request->only(['name','description']);
|
||||
$role->fill($update)->save();
|
||||
|
||||
$role->permissions()->sync($perms);
|
||||
|
||||
return redirect()->route('roles.index')->with('message','Role successfully edited.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//Find and remove user
|
||||
$role = Role::findOrFail($id);
|
||||
$role->permissions()->sync([]);
|
||||
$role->users()->sync([]);
|
||||
$role->delete();
|
||||
|
||||
return redirect()->route('roles.index')->with('message','Role successfully deleted.');
|
||||
}
|
||||
}
|
177
app/Http/Controllers/UserController.php
Normal file
177
app/Http/Controllers/UserController.php
Normal file
|
@ -0,0 +1,177 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\User;
|
||||
use App\Role;
|
||||
use App\Permission;
|
||||
use Middleware\Permissions;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Enforce middleware
|
||||
*/
|
||||
public function __construct(){
|
||||
$this->middleware(['auth']);
|
||||
$this->middleware(['permissions:CreateUser'], ['only' => ['create','store']]);
|
||||
$this->middleware(['permissions:CreateUser.EditUser.DeleteUser.AssignRole'], ['only' => ['index','show']]);
|
||||
$this->middleware(['permissions:DeleteUser'], ['only' => ['destroy']]);
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//Pass all users
|
||||
$users = User::get();
|
||||
return view('users.index')->with('users', $users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$roles = Role::get();
|
||||
return view('users.create')->with('roles',$roles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//Validate name, email and password
|
||||
$this->validate($request, [
|
||||
'name'=>'required|max:120',
|
||||
'email'=>'required|email|unique:users',
|
||||
'password'=>'required|min:6|confirmed'
|
||||
]);
|
||||
|
||||
$user = User::create($request->only('email', 'name', 'password')); //Retrieving only the email and password data
|
||||
|
||||
if(auth()->user()->hasPerm('AssignRole')){
|
||||
$roles = array();
|
||||
foreach($request->all() as $element => $value){
|
||||
if(preg_match('/r_.*/', $element)){
|
||||
array_push($roles, (int)$value);
|
||||
}
|
||||
}
|
||||
$user->roles()->sync($roles);
|
||||
}
|
||||
|
||||
//Redirect to the users.index view and display message
|
||||
return redirect()->route('users.index')->with('message','User successfully added.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//Redirect requests to view specific user to users index
|
||||
return redirect('users');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//verify user has permission to edit record
|
||||
if(auth()->user()->hasPerm('EditUser') || auth()->user()->id == $id){
|
||||
//Find user and pass to edit
|
||||
$user = User::with('roles')->findOrFail($id);
|
||||
|
||||
$roles=Role::get();
|
||||
$active_roles=array();
|
||||
$active_cats=array();
|
||||
foreach($user->roles as $role){
|
||||
array_push($active_roles,$role->id);
|
||||
}
|
||||
|
||||
return view('users.edit')->with('user',$user)->with('roles',$roles)->with('active_roles',$active_roles);
|
||||
}else{
|
||||
return redirect('/')->with('message','You don\'t have permission to access this page');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
if(auth()->user()->hasPerm('EditUser') || auth()->user()->id == $id){
|
||||
//Find and update user after validating
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
if($request->password != null && (auth()->user()->hasPerm('ResetPassword') || auth()->user()->id == $id)){
|
||||
$this->validate($request, [
|
||||
'name'=>'required|max:120',
|
||||
'email'=>'required|email|unique:users,email,'.$id,
|
||||
'password'=>'required|min:6|confirmed'
|
||||
]);
|
||||
$update = $request->only(['name','email','password']);
|
||||
}else{
|
||||
$this->validate($request, [
|
||||
'name'=>'required|max:120',
|
||||
'email'=>'required|email|unique:users,email,'.$id,
|
||||
]);
|
||||
$update = $request->only(['name','email']);
|
||||
}
|
||||
$user->fill($update)->save();
|
||||
|
||||
if(auth()->user()->hasPerm('AssignRole')){
|
||||
$roles = array();
|
||||
foreach($request->all() as $element => $value){
|
||||
if(preg_match('/r_.*/', $element)){
|
||||
array_push($roles, (int)$value);
|
||||
}
|
||||
}
|
||||
$user->roles()->sync($roles);
|
||||
}
|
||||
if (auth()->user()->hasPerm('EditUser')){
|
||||
return redirect()->route('users.index')->with('message','User successfully edited.');
|
||||
}else {
|
||||
return redirect(url()->previous())->with('message','User successfully edited.');
|
||||
}
|
||||
}else{
|
||||
return redirect('/')->with('message','You don\'t have permission to edit this user');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//Find and remove user
|
||||
$user = User::findOrFail($id);
|
||||
$user->roles()->sync([]);
|
||||
$user->delete();
|
||||
|
||||
return redirect()->route('users.index')->with('message','User successfully deleted.');
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ class Kernel extends HttpKernel
|
|||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
\App\Http\Middleware\ForceHttps::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -63,5 +64,6 @@ class Kernel extends HttpKernel
|
|||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'permissions' => \App\Http\Middleware\Permissions::class,
|
||||
];
|
||||
}
|
||||
|
|
23
app/Http/Middleware/ForceHttps.php
Normal file
23
app/Http/Middleware/ForceHttps.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class ForceHttps
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if(!$request->secure() && ( env('APP_ENV') === 'production' || env('APP_ENV') === 'testing')){
|
||||
return redirect()->secure($request->getRequestUri());
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
35
app/Http/Middleware/Permissions.php
Normal file
35
app/Http/Middleware/Permissions.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use App\User;
|
||||
|
||||
class Permissions
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $perm)
|
||||
{
|
||||
if($perm == "SHARE"){
|
||||
if ($request->user() == null){
|
||||
\View::share('allperms', []);
|
||||
\View::share('adminpages', []);
|
||||
return $next($request);
|
||||
}
|
||||
\View::share('allperms', $request->user()->getPerms());
|
||||
\View::share('adminpages', $request->user()->getAdmin());
|
||||
return $next($request);
|
||||
}
|
||||
if( $request->user()->hasPerm($perm)){
|
||||
return $next($request);
|
||||
}else{
|
||||
return redirect('/')->with('message','You don\'t have permission to access this page');
|
||||
}
|
||||
}
|
||||
}
|
15
app/Permission.php
Normal file
15
app/Permission.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Permission extends Model
|
||||
{
|
||||
protected $fillable = ['name','category','details'];
|
||||
|
||||
public function roles()
|
||||
{
|
||||
return $this->belongsToMany('App\Role');
|
||||
}
|
||||
}
|
20
app/Role.php
Normal file
20
app/Role.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Role extends Model
|
||||
{
|
||||
protected $fillable = ['name','description'];
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany('App\User');
|
||||
}
|
||||
|
||||
public function permissions()
|
||||
{
|
||||
return $this->belongsToMany('App\Permission');
|
||||
}
|
||||
}
|
85
app/User.php
85
app/User.php
|
@ -2,38 +2,69 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
use Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password',
|
||||
];
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
//Encrypt password when it's set - this ensures encryption is handled in one place
|
||||
public function setPasswordAttribute($password){
|
||||
$this->attributes['password'] = bcrypt($password);
|
||||
}
|
||||
|
||||
public function roles()
|
||||
{
|
||||
return $this->belongsToMany('App\Role');
|
||||
}
|
||||
|
||||
public function getPerms(){
|
||||
$roles = $this->roles;
|
||||
$perms = array();
|
||||
foreach ($roles as $role){
|
||||
foreach ($role->permissions as $permission){
|
||||
$perms[$permission->id]=str_replace(' ', '', $permission->name);
|
||||
}
|
||||
}
|
||||
return $perms;
|
||||
}
|
||||
public function getAdmin(){
|
||||
$roles = $this->roles;
|
||||
$categories = array();
|
||||
foreach ($roles as $role){
|
||||
foreach ($role->permissions as $permission){
|
||||
array_push($categories,$permission->category);
|
||||
}
|
||||
}
|
||||
return array_diff(array_unique($categories),[]);
|
||||
}
|
||||
public function hasPerm($permlist){
|
||||
$testperms = explode('.',$permlist);
|
||||
$perms = $this->getPerms();
|
||||
foreach ($testperms as $perm){
|
||||
if (in_array($perm,$perms)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
"fruitcake/laravel-cors": "^1.0",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"laravel/framework": "^7.0",
|
||||
"laravel/tinker": "^2.0"
|
||||
"laravel/tinker": "^2.0",
|
||||
"laravel/ui": "^2.1",
|
||||
"laravelcollective/html": "^6.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.0",
|
||||
|
|
125
composer.lock
generated
125
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6558f74828bca9ebecac73d90cea4b1a",
|
||||
"content-hash": "e3388eb2d0594e56cff7b50310100f73",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
|
@ -960,6 +960,129 @@
|
|||
],
|
||||
"time": "2020-07-07T15:10:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/ui",
|
||||
"version": "v2.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/ui.git",
|
||||
"reference": "da9350533d0da60d5dc42fb7de9c561c72129bba"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/ui/zipball/da9350533d0da60d5dc42fb7de9c561c72129bba",
|
||||
"reference": "da9350533d0da60d5dc42fb7de9c561c72129bba",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/console": "^7.0",
|
||||
"illuminate/filesystem": "^7.0",
|
||||
"illuminate/support": "^7.0",
|
||||
"php": "^7.2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.0",
|
||||
"phpunit/phpunit": "^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Laravel\\Ui\\UiServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laravel\\Ui\\": "src/",
|
||||
"Illuminate\\Foundation\\Auth\\": "auth-backend/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"description": "Laravel UI utilities and presets.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"ui"
|
||||
],
|
||||
"time": "2020-06-30T20:56:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravelcollective/html",
|
||||
"version": "v6.1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/LaravelCollective/html.git",
|
||||
"reference": "5ef9a3c9ae2423fe5618996f3cde375d461a3fc6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/LaravelCollective/html/zipball/5ef9a3c9ae2423fe5618996f3cde375d461a3fc6",
|
||||
"reference": "5ef9a3c9ae2423fe5618996f3cde375d461a3fc6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/http": "^6.0|^7.0",
|
||||
"illuminate/routing": "^6.0|^7.0",
|
||||
"illuminate/session": "^6.0|^7.0",
|
||||
"illuminate/support": "^6.0|^7.0",
|
||||
"illuminate/view": "^6.0|^7.0",
|
||||
"php": ">=7.2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/database": "^6.0|^7.0",
|
||||
"mockery/mockery": "~1.0",
|
||||
"phpunit/phpunit": "~7.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Collective\\Html\\HtmlServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Form": "Collective\\Html\\FormFacade",
|
||||
"Html": "Collective\\Html\\HtmlFacade"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Collective\\Html\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Adam Engebretson",
|
||||
"email": "adam@laravelcollective.com"
|
||||
},
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylorotwell@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "HTML and Form Builders for the Laravel Framework",
|
||||
"homepage": "https://laravelcollective.com",
|
||||
"time": "2020-05-19T18:02:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/commonmark",
|
||||
"version": "1.5.3",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
|
@ -14,14 +14,27 @@ class CreateUsersTable extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('email');
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
|
||||
if(env('DB_CONNECTION') == 'mysql'){
|
||||
$table->unique([DB::raw('email(191)')]);
|
||||
}else{
|
||||
$table->unique('email');
|
||||
}
|
||||
});
|
||||
|
||||
//Insert default admin
|
||||
DB::table('users')->insert([
|
||||
'name' => 'Admin',
|
||||
'email' => 'admin@example.com',
|
||||
'password' => bcrypt('temp'),
|
||||
'created_at' => NOW()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
33
database/migrations/2020_07_27_221656_create_roles_table.php
Normal file
33
database/migrations/2020_07_27_221656_create_roles_table.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateRolesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('description');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePermissionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('permissions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('category');
|
||||
$table->string('details');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('permissions');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePermissionRoleTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('permission_role', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('role_id');
|
||||
$table->unsignedInteger('permission_id');
|
||||
$table->timestamps();
|
||||
|
||||
|
||||
$table->foreign('role_id')->references('id')->on('roles');
|
||||
$table->foreign('permission_id')->references('id')->on('permissions');
|
||||
$table->unique(['role_id','permission_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('permission_role');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateRoleUserTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('role_user', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->unsignedInteger('role_id');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->foreign('role_id')->references('id')->on('roles');
|
||||
$table->unique(['user_id','role_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('role_user');
|
||||
}
|
||||
}
|
|
@ -12,5 +12,7 @@ class DatabaseSeeder extends Seeder
|
|||
public function run()
|
||||
{
|
||||
// $this->call(UserSeeder::class);
|
||||
$this->call(PermissionSeeder::class);
|
||||
$this->call(RoleSeeder::class);
|
||||
}
|
||||
}
|
||||
|
|
30
database/seeds/PermissionSeeder.php
Normal file
30
database/seeds/PermissionSeeder.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Permission;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$permissions = [
|
||||
['name'=>'Create User', 'category'=>'Users', 'details'=>'Create New Users'],
|
||||
['name'=>'Edit User', 'category'=>'Users', 'details'=>'Edit Existing Users'],
|
||||
['name'=>'Delete User', 'category'=>'Users', 'details'=>'Delete Existing Users'],
|
||||
['name'=>'Reset Password', 'category'=>'Users', 'details'=>'Change User\'s Password'],
|
||||
['name'=>'Assign Role', 'category'=>'Users', 'details'=>'Add/Remove Roles to/from Users'],
|
||||
|
||||
['name'=>'Create Role', 'category'=>'Roles', 'details'=>'Create New Roles'],
|
||||
['name'=>'Edit Role', 'category'=>'Roles', 'details'=>'Edit Existing Roles'],
|
||||
['name'=>'Delete Role', 'category'=>'Roles', 'details'=>'Delete Existing Roles'],
|
||||
];
|
||||
foreach ($permissions as $key => $value) {
|
||||
Permission::updateOrCreate($value);
|
||||
}
|
||||
}
|
||||
}
|
39
database/seeds/RoleSeeder.php
Normal file
39
database/seeds/RoleSeeder.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Role;
|
||||
use App\User;
|
||||
use App\Permission;
|
||||
|
||||
class RoleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$user_admin=Role::updateOrCreate(['name'=>'User Admin', 'description'=>'Administrates Users']);
|
||||
$role_admin=Role::updateOrCreate(['name'=>'Role Admin', 'description'=>'Administrates Roles']);
|
||||
|
||||
|
||||
$user_perms=['Create User','Edit User','Delete User','Reset Password','Assign Role'];
|
||||
$uperms=array();
|
||||
foreach ($user_perms as $perm){
|
||||
array_push($uperms,Permission::where('name',$perm)->first()->id);
|
||||
}
|
||||
$user_admin->permissions()->sync($uperms);
|
||||
|
||||
$role_perms=['Create Role','Edit Role','Delete Role'];
|
||||
$rperms=array();
|
||||
foreach ($role_perms as $perm){
|
||||
array_push($rperms,Permission::where('name',$perm)->first()->id);
|
||||
}
|
||||
$role_admin->permissions()->sync($rperms);
|
||||
|
||||
//Add User and Role Admin to first entry in Users Table
|
||||
$first_user = User::orderBy('id')->first();
|
||||
$first_user->roles()->sync([$user_admin->id,$role_admin->id]);
|
||||
}
|
||||
}
|
9
public/css/app.css
vendored
Normal file
9
public/css/app.css
vendored
Normal file
File diff suppressed because one or more lines are too long
26
public/css/gallery.css
vendored
Normal file
26
public/css/gallery.css
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
#showcase {
|
||||
height: 450px;
|
||||
overflow: visible !important;
|
||||
}
|
||||
.card {
|
||||
width: 320px;
|
||||
padding: 12px;
|
||||
text-align: center;
|
||||
background-color: var(--primary-bg-dark);
|
||||
border: 2px white dotted;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.card h2 {
|
||||
margin: 0 0 7px 0;
|
||||
}
|
||||
.card p {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.tag-selector,.speed-selector{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#hidden-cards{
|
||||
display:none;
|
||||
}
|
231
public/css/layout.css
vendored
Normal file
231
public/css/layout.css
vendored
Normal file
|
@ -0,0 +1,231 @@
|
|||
/***color definitions***/
|
||||
:root{
|
||||
/***light/dark determined from here: https://www.hexcolortool.com/ - convert css to sass files at later date and use built in tools***/
|
||||
--primary-bg: #eae4da;/*light blue*/
|
||||
--primary-bg-offset: #ccbca4;/*20% darker*/
|
||||
--primary-bg-dark: #dbd0bf;/*10% darker*/
|
||||
--primary-bg-light: #f9f8f5;/*10% lighter*/
|
||||
--primary-font: #000;/*black*/
|
||||
--primary-highlight: #0006d4;/*red*/
|
||||
--primary-highlight-dark: #00013f;/*20% darker*/
|
||||
--secondary-highlight: #d40074;/*orange*/
|
||||
}
|
||||
|
||||
/***this is background***/
|
||||
html {
|
||||
height:100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--primary-bg);
|
||||
margin: 0;
|
||||
min-height:100%;
|
||||
padding-bottom:75px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/***this is for page heading***/
|
||||
|
||||
h1 {
|
||||
color: black;
|
||||
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
|
||||
font-size: 26px;
|
||||
margin:0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/***this is for subheading***/
|
||||
|
||||
h2 {
|
||||
color: black;
|
||||
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
/***this is the paragraph text***/
|
||||
|
||||
p, .panel-body {
|
||||
color: black;
|
||||
font-family: Garamond, Baskerville, Baskerville Old Face, Hoefler Text, Times New Roman, serif;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.mail,.tel,.question,.dark-link {font-weight:bold;
|
||||
color: var(--primary-highlight);
|
||||
}
|
||||
|
||||
/***this is the banner/logo placement***/
|
||||
|
||||
header {
|
||||
left: 10px;
|
||||
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
/***this is placement/style for the right menu***/
|
||||
|
||||
.right-nav{
|
||||
background-color:var(--primary-bg-offset);
|
||||
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
|
||||
font-size: 15px;
|
||||
border:none;
|
||||
padding-right:10px;
|
||||
}
|
||||
|
||||
/***this is style for links in the right menu***/
|
||||
.right-nav .navbar-brand, .right-nav .navbar-nav>li>a,.right-nav .navbar-text{
|
||||
color:var(--primary-highlight);
|
||||
}
|
||||
/***hover style for links***/
|
||||
.right-nav .navbar-nav>li>a:focus,.right-nav .navbar-nav>li>a:hover{
|
||||
color:var(--primary-highlight-dark);
|
||||
}
|
||||
|
||||
/***this is placement/style for left menu***/
|
||||
|
||||
.left-nav{
|
||||
background-color:var(--primary-bg-offset);
|
||||
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
|
||||
font-size: 18px;
|
||||
border:none;
|
||||
margin-bottom:0;
|
||||
padding-left:10 px;
|
||||
}
|
||||
|
||||
/***this is style for links in the left menu***/
|
||||
.left-nav .navbar-brand, .left-nav .navbar-nav>li>a,.left-nav .navbar-text{
|
||||
color:var(--primary-highlight);
|
||||
}
|
||||
|
||||
/***hover style for links***/
|
||||
.left-nav .navbar-nav>li>a:focus,.left-nav .navbar-nav>li>a:hover{
|
||||
color:var(--primary-highlight-dark);
|
||||
}
|
||||
|
||||
/***active page style for navigation***/
|
||||
.left-nav .navbar-nav>li>.active-page,.left-nav .navbar-nav>li>.active-page:focus,.left-nav .navbar-nav>li>.active-page:hover,
|
||||
.right-nav .navbar-nav>li>.active-page,.right-nav .navbar-nav>li>.active-page:focus,.right-nav .navbar-nav>li>.active-page:hover{
|
||||
color: var(--secondary-highlight);/*orange*/
|
||||
}
|
||||
|
||||
container {
|
||||
background-color:var(--primary-bg);
|
||||
}
|
||||
|
||||
.font {color:var(--primary-highlight);
|
||||
|
||||
}
|
||||
|
||||
.form_name {
|
||||
color:var(--primary-highlight);
|
||||
}
|
||||
|
||||
nav {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
section {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
aside {
|
||||
float:right;
|
||||
}
|
||||
|
||||
list {
|
||||
float:left;
|
||||
margin:20px;
|
||||
width:250px
|
||||
}
|
||||
|
||||
.pic {
|
||||
float:right;
|
||||
width:350px
|
||||
margin:10px;
|
||||
width:30%;;
|
||||
}
|
||||
|
||||
.list {
|
||||
color: black;
|
||||
font-family: Garamond, Baskerville, Baskerville Old Face, Hoefler Text, Times New Roman, serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.footer_black {
|
||||
color: black;
|
||||
font-family: Garamond, Baskerville, Baskerville Old Face, Hoefler Text, Times New Roman, serif;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/***.footer_red{
|
||||
color: var(--primary-highlight);
|
||||
font-family: Garamond, Baskerville, Baskerville Old Face, Hoefler Text, Times New Roman, serif;
|
||||
font-size: 14px;
|
||||
} ***/
|
||||
|
||||
/***push footer to bottom of page***/
|
||||
.footer{
|
||||
background-color:var(--primary-bg-offset);
|
||||
bottom: 0;
|
||||
left:auto;
|
||||
padding:5px;
|
||||
position: absolute;
|
||||
right:auto;
|
||||
text-align: center;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.panel-default>.pannel-body,.panel-default>.panel-heading,.panel-default{
|
||||
background-color: var(--primary-bg);
|
||||
border:none;
|
||||
box-shadow:none;
|
||||
}
|
||||
|
||||
/***apply to every other table row***/
|
||||
.table-striped > tbody > tr:nth-of-type(2n+1){
|
||||
background-color: var(--primary-bg-dark);
|
||||
}
|
||||
|
||||
/***apply to every other table row***/
|
||||
.table-striped > tbody > tr:nth-of-type(2n){
|
||||
background-color: var(--primary-bg-light);
|
||||
}
|
||||
|
||||
/***apply highlight style***/
|
||||
.primary-highlight{
|
||||
color:var(--primary-highlight-dark);
|
||||
}
|
||||
|
||||
.header-section{
|
||||
background-color: var(--primary-bg-offset)
|
||||
}
|
||||
|
||||
|
||||
.hideOverflow{
|
||||
overflow:hidden
|
||||
}
|
||||
|
||||
.faq-title{
|
||||
font-weight: bold;
|
||||
}
|
||||
.faq-body{
|
||||
background-color: var(--primary-bg-light);
|
||||
}
|
||||
|
||||
.bottomRight{
|
||||
display:none;
|
||||
}
|
||||
|
||||
.back-to-top{
|
||||
color: var(--secondary-highlight);
|
||||
display:none;
|
||||
}
|
||||
.nav-tabs{
|
||||
border-bottom-color:var(--primary-bg-offset);
|
||||
}
|
||||
.tab-divider{
|
||||
border-color: var(--primary-bg-offset);
|
||||
}
|
||||
.fix-spacing{
|
||||
padding-top: 30px;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.1 KiB |
BIN
public/files/images/banner.png
Normal file
BIN
public/files/images/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
1
public/js/app.js
vendored
Normal file
1
public/js/app.js
vendored
Normal file
File diff suppressed because one or more lines are too long
71
resources/views/auth/login.blade.php
Normal file
71
resources/views/auth/login.blade.php
Normal file
|
@ -0,0 +1,71 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h1>Login</h1></div>
|
||||
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="POST" action="{{ route('login') }}">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
|
||||
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
|
||||
|
||||
@if ($errors->has('email'))
|
||||
<span class="help-block">
|
||||
<strong>{{ $errors->first('email') }}</strong>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
|
||||
<label for="password" class="col-md-4 control-label">Password</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="password" type="password" class="form-control" name="password" required>
|
||||
|
||||
@if ($errors->has('password'))
|
||||
<span class="help-block">
|
||||
<strong>{{ $errors->first('password') }}</strong>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-6 col-md-offset-4">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-8 col-md-offset-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Login
|
||||
</button>
|
||||
|
||||
<a class="btn btn-link" href="{{ route('password.request') }}">
|
||||
Forgot Your Password?
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
47
resources/views/auth/passwords/email.blade.php
Normal file
47
resources/views/auth/passwords/email.blade.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Reset Password</div>
|
||||
|
||||
<div class="panel-body">
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form class="form-horizontal" method="POST" action="{{ route('password.email') }}">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
|
||||
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>
|
||||
|
||||
@if ($errors->has('email'))
|
||||
<span class="help-block">
|
||||
<strong>{{ $errors->first('email') }}</strong>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-6 col-md-offset-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Send Password Reset Link
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
70
resources/views/auth/passwords/reset.blade.php
Normal file
70
resources/views/auth/passwords/reset.blade.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Reset Password</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="POST" action="{{ route('password.request') }}">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<input type="hidden" name="token" value="{{ $token }}">
|
||||
|
||||
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
|
||||
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" required autofocus>
|
||||
|
||||
@if ($errors->has('email'))
|
||||
<span class="help-block">
|
||||
<strong>{{ $errors->first('email') }}</strong>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
|
||||
<label for="password" class="col-md-4 control-label">Password</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="password" type="password" class="form-control" name="password" required>
|
||||
|
||||
@if ($errors->has('password'))
|
||||
<span class="help-block">
|
||||
<strong>{{ $errors->first('password') }}</strong>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
|
||||
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
|
||||
<div class="col-md-6">
|
||||
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
|
||||
|
||||
@if ($errors->has('password_confirmation'))
|
||||
<span class="help-block">
|
||||
<strong>{{ $errors->first('password_confirmation') }}</strong>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-6 col-md-offset-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Reset Password
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
30
resources/views/home.blade.php
Normal file
30
resources/views/home.blade.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h1>About us</h1></div>
|
||||
<img class="img-responsive col-sm-4 bottomRight" src="{{ asset('storage/images/town_building.jpg')}}" alt="building">
|
||||
<div class="panel-body">
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque facilisis cursus libero, ut feugiat risus scelerisque ut. Mauris felis dui, molestie egestas nunc vel, viverra suscipit enim. Morbi nisl enim, facilisis vitae nibh quis, elementum cursus massa. Nullam finibus, arcu eu tempor cursus, nisi tortor blandit urna, ac aliquam leo nibh viverra lacus. Pellentesque lobortis eros a dui finibus, id sollicitudin enim sagittis. Proin vitae ipsum consectetur, egestas nisi gravida, consequat metus. Fusce lacinia orci vel libero dictum mollis. Integer tincidunt metus mauris, sed pellentesque sem vestibulum id. Fusce leo felis, blandit viverra venenatis sed, iaculis at nisl. Cras auctor pulvinar dui, ut blandit tortor malesuada ac. Nunc vitae tellus ac ligula tristique maximus. Ut maximus ex ut sem sodales, et aliquet orci varius.</p>
|
||||
|
||||
<p>Donec pulvinar quis tortor et volutpat. Etiam non odio euismod, sagittis eros et, molestie velit. Phasellus ornare molestie diam, et porta diam dignissim et. Phasellus a purus sit amet arcu convallis varius. Aenean sapien libero, semper eu odio sit amet, euismod condimentum velit. Phasellus id nulla commodo sem sagittis posuere. Aliquam facilisis, lectus congue euismod rhoncus, sapien leo dictum massa, eu sodales lectus libero at odio. Duis elit ante, maximus fringilla leo eget, pulvinar sagittis tellus. Suspendisse sed fringilla ex. Nam vitae orci sit amet nisi rhoncus sollicitudin. Ut quis ullamcorper nibh.</p>
|
||||
|
||||
<p>Phasellus ultricies sed lorem consectetur elementum. Nunc quis blandit urna. Cras ut faucibus massa. Proin sodales turpis ut metus finibus, id lacinia felis commodo. Pellentesque cursus urna rhoncus, feugiat ligula id, convallis mi. Etiam sodales mauris ut nisl ultricies sagittis eget viverra magna. Pellentesque in sem lacinia nisi porta consequat. Cras et mi ipsum. Suspendisse mattis magna nibh, sit amet cursus augue congue a. Sed turpis justo, elementum ut volutpat quis, maximus et dolor. Quisque vel nibh justo.</p>
|
||||
|
||||
<p>Pellentesque egestas molestie posuere. Cras massa turpis, dignissim vel lorem aliquet, pretium posuere ex. Phasellus elementum dictum velit sit amet cursus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris sed risus in ante pharetra fringilla. In mattis, leo nec tincidunt convallis, augue enim commodo mauris, a blandit justo est sit amet nisl. Aenean ac nulla nisl. Aenean a accumsan dolor, ut interdum elit. Pellentesque euismod orci sit amet augue porttitor ultrices. In porta sollicitudin dui. Sed euismod aliquet tristique. Pellentesque non molestie mi. Cras non lectus convallis, scelerisque justo eget, sodales orci. Duis pellentesque ligula risus, et consequat velit dictum in.</p>
|
||||
|
||||
<p>Nam eleifend, nisi at ultricies venenatis, velit est congue lacus, at elementum erat lorem quis orci. Proin ac dolor quis odio convallis ultricies. Morbi ut ligula vitae nisi rhoncus porttitor ac a dui. In hac habitasse platea dictumst. Quisque cursus finibus pretium. Phasellus ac lacus vel sapien aliquam pellentesque eget sit amet ex. In congue libero nibh, nec laoreet lorem blandit et. Aenean sit amet viverra magna. Quisque vehicula tincidunt cursus. Integer tincidunt enim et ultrices egestas. Nulla in arcu sed risus porta pulvinar vehicula eu diam. In facilisis, nisl in pharetra ultricies, mauris tellus venenatis ipsum, ac sodales justo sem vitae risus. Vivamus vel faucibus ligula. Maecenas sollicitudin turpis ut turpis hendrerit vehicula.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
105
resources/views/layouts/default.blade.php
Normal file
105
resources/views/layouts/default.blade.php
Normal file
|
@ -0,0 +1,105 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<title>{{ config('app.name') }} @yield('title')</title>
|
||||
|
||||
<!--favicon link-->
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Styles -->
|
||||
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||
@yield('third_party_styles')
|
||||
<link href="{{ asset('css/layout.css') }}" rel="stylesheet">
|
||||
@yield('styles')
|
||||
</head>
|
||||
<body>
|
||||
<a name="top"></a>
|
||||
<!-- Set adminmode -->
|
||||
@guest
|
||||
{{session()->put(["adminmode",false])}}
|
||||
@else
|
||||
{{session()->has("adminmode") ? "" : session("adminmode",false)}}
|
||||
@endguest
|
||||
<div id="app">
|
||||
<div class="header-section">
|
||||
<div class="row no-gutters">
|
||||
<div class="col-sm-12">
|
||||
@include('layouts.segments.banner')
|
||||
</div>
|
||||
<div>
|
||||
<nav class="navbar navbar-default navbar-static-top navbar-right right-nav">
|
||||
<div class="navbar-header">
|
||||
<!-- Collapsed Hamburger -->
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".main-nav" aria-expanded="false">
|
||||
<span class="sr-only">Toggle Navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<nav class="navbar navbar-default navbar-static-top left-nav">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<div class="collapse navbar-collapse main-nav">
|
||||
<!-- Left Side Of Navbar -->
|
||||
<ul class="nav navbar-nav">
|
||||
@include('layouts.segments.navigation')
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!--this is a line
|
||||
<hr class="divider">-->
|
||||
<div class="container alerts">
|
||||
<!-- display normal messages -->
|
||||
@if(Session::has('message'))
|
||||
<div class="alert alert-success">{!! session('message') !!}</div>
|
||||
@endif
|
||||
<!-- display error messages -->
|
||||
@if(!empty($errors->all()))
|
||||
<div class="alert alert-error">
|
||||
@foreach ($errors->all() as $error)
|
||||
<div>{{ $error }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
@yield('content')
|
||||
</div>
|
||||
|
||||
<!--push footer to bottom of page-->
|
||||
<div class="footer" >
|
||||
@include('layouts.segments.footer')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="{{ asset('js/app.js') }}"></script>
|
||||
@yield('scripts')
|
||||
<script>
|
||||
$(window).resize(function(){
|
||||
setTimeout(function(){
|
||||
showBTT();
|
||||
},100);
|
||||
});
|
||||
function showBTT(){
|
||||
if($(window).height()*1.5<$(document).height()){
|
||||
$('.back-to-top').show();
|
||||
}else{
|
||||
$('.back-to-top').hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
8
resources/views/layouts/segments/banner.blade.php
Normal file
8
resources/views/layouts/segments/banner.blade.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<div id="header">
|
||||
<!--logo-->
|
||||
<header>
|
||||
<a href="{{ route('home') }}">
|
||||
<img id="banner" class="img-responsive" src="{{ asset('files/images/banner.png')}}" style="width:100%">
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
6
resources/views/layouts/segments/footer.blade.php
Normal file
6
resources/views/layouts/segments/footer.blade.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<div class="back-to-top center"><a href="#top" class="dark-link">Back to Top</a></div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4 footer_black" >Location: <b>Stevens Point</b> Phone: <b><a href="tel:123-456-7890"><span class="tel">123-456-7890</span></a></b> </div>
|
||||
<div class="col-sm-4 footer_black">2018 © Ace & Aro Web Development</div>
|
||||
<div class="col-sm-4 footer_black" >Mail to: <b>000 Street Name, Stevens Point, WI 54543</b></div>
|
||||
</div>
|
1
resources/views/layouts/segments/link.blade.php
Normal file
1
resources/views/layouts/segments/link.blade.php
Normal file
|
@ -0,0 +1 @@
|
|||
<li><a href="{{ route($route) }}" class="{{Request::route()->getName() == $route? 'active-page' : ''}}">{{ $text }}</a></li>
|
4
resources/views/layouts/segments/logout.blade.php
Normal file
4
resources/views/layouts/segments/logout.blade.php
Normal file
|
@ -0,0 +1,4 @@
|
|||
<li>
|
||||
<a href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">Logout</a>
|
||||
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">{{ csrf_field() }}</form>
|
||||
</li>
|
19
resources/views/layouts/segments/navigation.blade.php
Normal file
19
resources/views/layouts/segments/navigation.blade.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
@if(session("adminmode"))
|
||||
<!-- Admin Links -->
|
||||
@if(in_array('Users',$adminpages))
|
||||
@include('layouts.segments.link', ['route'=>'users.index','text'=>'Users'])
|
||||
@endif
|
||||
@if(in_array('Roles',$adminpages))
|
||||
@include('layouts.segments.link', ['route'=>'roles.index','text'=>'Roles'])
|
||||
@endif
|
||||
@else
|
||||
<!-- Standard Links -->
|
||||
@include('layouts.segments.link', ['route'=>'home','text'=>'Home'])
|
||||
|
||||
<!-- Authentication Links -->
|
||||
@guest
|
||||
@include('layouts.segments.link', ['route'=>'login','text'=>'Login'])
|
||||
@else
|
||||
@include('layouts.segments.logout')
|
||||
@endguest
|
||||
@endif
|
63
resources/views/roles/create.blade.php
Normal file
63
resources/views/roles/create.blade.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('title', '| Add Role')
|
||||
|
||||
@section('scripts')
|
||||
<script src="{{ asset('js/role_categories.js') }}"></script>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class='col-lg-8 col-lg-offset-2'>
|
||||
<div class='panel panel-default'>
|
||||
<div class='panel-heading'><h1>Add Role</h1></div>
|
||||
|
||||
<div class='panel-body'>
|
||||
{{ Form::open(array('url' => 'roles')) }}
|
||||
|
||||
<div class='form-group'>
|
||||
{{ Form::label('name', 'Name') }}
|
||||
{{ Form::text('name', '', array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
<div class='form-group'>
|
||||
{{ Form::label('description', 'Description') }}
|
||||
{{ Form::textarea('description', '', array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
<br/><h1>Permissions</h1>
|
||||
|
||||
<div class='panel-group' id='accordion'>
|
||||
@foreach ($permissions as $key=>$category)
|
||||
<div class='panel panel-default'>
|
||||
|
||||
<div class='panel-heading'>
|
||||
<h2 class='panel-title'>
|
||||
<a data-toggle='collapse' data-parent='#accordion' href='#collapse{{str_replace(' ','',$key)}}'>{{$key}}</a>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div id='collapse{{str_replace(' ','',$key)}}' class='panel-collapse collapse'>
|
||||
<div class='panel-body'>
|
||||
@foreach ($category as $permission)
|
||||
<div class='col-md-6'>
|
||||
<div class='form-group'>
|
||||
{{ Form::checkbox('p_'.$permission->id,$permission->id)}}
|
||||
{{ Form::label('name', $permission->name) }}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{ Form::submit('Add', array('class' => 'btn btn-primary')) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
67
resources/views/roles/edit.blade.php
Normal file
67
resources/views/roles/edit.blade.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('title', '| Edit Role')
|
||||
|
||||
@section('scripts')
|
||||
<script src="{{ asset('js/role_categories.js') }}"></script>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class='col-lg-8 col-lg-offset-2'>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h1>Edit {{$role->name}}</h1></div>
|
||||
|
||||
<div class="panel-body">
|
||||
{{ Form::model($role, array('route' => array('roles.update', $role->id), 'method' => 'PUT')) }}{{-- Form model binding to automatically populate our fields with role data --}}
|
||||
|
||||
<div class='form-group'>
|
||||
{{ Form::label('name', 'Name') }}
|
||||
{{ Form::text('name', null, array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
<div class='form-group'>
|
||||
{{ Form::label('description', 'Description') }}
|
||||
{{ Form::textarea('description', null, array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
<br/><h1>Permissions</h1>
|
||||
|
||||
<div class='panel-group' id='accordion'>
|
||||
@foreach ($permissions as $key=>$category)
|
||||
<div class='panel panel-default'>
|
||||
|
||||
<div class='panel-heading'>
|
||||
<h2 class='panel-title @if(in_array($key,$active_cats))font-weight-bold @endif'>
|
||||
<a data-toggle='collapse' data-parent='#accordion' href='#collapse{{str_replace(' ','',$key)}}'>{{$key}}</a>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div id='collapse{{str_replace(' ','',$key)}}' class='panel-collapse collapse'>
|
||||
<div class='panel-body'>
|
||||
@foreach ($category as $permission)
|
||||
<div class='col-md-6'>
|
||||
<div class='form-group'>
|
||||
@if(in_array($permission->id,$active_perms))
|
||||
{{ Form::checkbox('p_'.$permission->id,$permission->id,1)}}
|
||||
@else
|
||||
{{ Form::checkbox('p_'.$permission->id,$permission->id)}}
|
||||
@endif
|
||||
{{ Form::label('name', $permission->name) }}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{ Form::submit('Save', array('class' => 'btn btn-primary')) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
54
resources/views/roles/index.blade.php
Normal file
54
resources/views/roles/index.blade.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('title', '| Roles')
|
||||
|
||||
@section('content')
|
||||
<div class="col-lg-10 col-lg-offset-1">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h1>Role Administration</h1></div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Operations</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($roles as $role)
|
||||
<tr>
|
||||
|
||||
<td>{{ $role->name }}</td>
|
||||
<td>{{ $role->description }}</td>
|
||||
<td>
|
||||
|
||||
@if(in_array('EditRole',$allperms))
|
||||
<a href="{{ route('roles.edit', $role->id) }}" class="btn btn-info pull-left" style="margin-right: 3px;">Edit</a>
|
||||
@endif
|
||||
|
||||
@if(in_array('DeleteRole',$allperms))
|
||||
{!! Form::open(['method' => 'DELETE', 'route' => ['roles.destroy', $role->id] ]) !!}
|
||||
{!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!}
|
||||
{!! Form::close() !!}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@if(in_array('CreateRole',$allperms))
|
||||
<a href="{{ route('roles.create') }}" class="btn btn-success">Add Role</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
54
resources/views/users/create.blade.php
Normal file
54
resources/views/users/create.blade.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('title', '| Add User')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class='col-lg-8 col-lg-offset-2'>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h1>Add User</h1></div>
|
||||
|
||||
<div class="panel-body">
|
||||
{{ Form::open(array('url' => 'users')) }}
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('name', 'Name') }}
|
||||
{{ Form::text('name', '', array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('email', 'Email') }}
|
||||
{{ Form::email('email', '', array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('password', 'Password') }}<br>
|
||||
{{ Form::password('password', array('class' => 'form-control')) }}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('password', 'Confirm Password') }}<br>
|
||||
{{ Form::password('password_confirmation', array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
@if(in_array('AssignRole',$allperms))
|
||||
<h1>Roles</h1>
|
||||
@foreach ($roles as $role)
|
||||
<div class='col-md-6'>
|
||||
<div class='form-group'>
|
||||
{{ Form::checkbox('r_'.$role->id,$role->id)}}
|
||||
{{ Form::label('name', $role->name) }}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
{{ Form::submit('Add', array('class' => 'btn btn-primary')) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
60
resources/views/users/edit.blade.php
Normal file
60
resources/views/users/edit.blade.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('title', '| Edit User')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class='col-lg-8 col-lg-offset-2'>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h1>Edit {{$user->name}}</h1></div>
|
||||
|
||||
<div class="panel-body">
|
||||
{{ Form::model($user, array('route' => array('users.update', $user->id), 'method' => 'PUT')) }}{{-- Form model binding to automatically populate our fields with user data --}}
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('name', 'Name') }}
|
||||
{{ Form::text('name', null, array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('email', 'Email') }}
|
||||
{{ Form::email('email', null, array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
@if(in_array('ResetPassword',$allperms) || Auth::user()->id == $user->id)
|
||||
<br/><h4>Leave blank to keep existing password</h4>
|
||||
<div class="form-group">
|
||||
{{ Form::label('password', 'Password') }}<br>
|
||||
{{ Form::password('password', array('class' => 'form-control')) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('password', 'Confirm Password') }}<br>
|
||||
{{ Form::password('password_confirmation', array('class' => 'form-control')) }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(in_array('AssignRole',$allperms))
|
||||
<h1>Roles</h1>
|
||||
@foreach ($roles as $role)
|
||||
<div class='col-md-6'>
|
||||
<div class='form-group'>
|
||||
@if(in_array($role->id,$active_roles))
|
||||
{{ Form::checkbox('r_'.$role->id,$role->id,1)}}
|
||||
@else
|
||||
{{ Form::checkbox('r_'.$role->id,$role->id)}}
|
||||
@endif
|
||||
{{ Form::label('name', $role->name) }}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
{{ Form::submit('Save', array('class' => 'btn btn-primary')) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
55
resources/views/users/index.blade.php
Normal file
55
resources/views/users/index.blade.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
@extends('layouts.default')
|
||||
|
||||
@section('title', '| Users')
|
||||
|
||||
@section('content')
|
||||
<div class="col-lg-10 col-lg-offset-1">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h1>User Administration</h1></div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Date/Time Added</th>
|
||||
<th>Operations</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($users as $user)
|
||||
<tr>
|
||||
|
||||
<td>{{ $user->name }}</td>
|
||||
<td>{{ $user->email }}</td>
|
||||
<td>{{ $user->created_at->format('F d, Y h:ia') }}</td>
|
||||
<td>
|
||||
@if(in_array('EditUser',$allperms))
|
||||
<a href="{{ route('users.edit', $user->id) }}" class="btn btn-info pull-left" style="margin-right: 3px;">Edit</a>
|
||||
@endif
|
||||
|
||||
@if(in_array('DeleteUser',$allperms))
|
||||
{!! Form::open(['method' => 'DELETE', 'route' => ['users.destroy', $user->id] ]) !!}
|
||||
{!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!}
|
||||
{!! Form::close() !!}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
@if(in_array('CreateUser',$allperms))
|
||||
<a href="{{ route('users.create') }}" class="btn btn-success">Add User</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
|
@ -1,100 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Laravel</title>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
color: #636b6f;
|
||||
font-family: 'Nunito', sans-serif;
|
||||
font-weight: 200;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.full-height {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.flex-center {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.position-ref {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.top-right {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 84px;
|
||||
}
|
||||
|
||||
.links > a {
|
||||
color: #636b6f;
|
||||
padding: 0 25px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
letter-spacing: .1rem;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.m-b-md {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="flex-center position-ref full-height">
|
||||
@if (Route::has('login'))
|
||||
<div class="top-right links">
|
||||
@auth
|
||||
<a href="{{ url('/home') }}">Home</a>
|
||||
@else
|
||||
<a href="{{ route('login') }}">Login</a>
|
||||
|
||||
@if (Route::has('register'))
|
||||
<a href="{{ route('register') }}">Register</a>
|
||||
@endif
|
||||
@endauth
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="content">
|
||||
<div class="title m-b-md">
|
||||
Laravel
|
||||
</div>
|
||||
|
||||
<div class="links">
|
||||
<a href="https://laravel.com/docs">Docs</a>
|
||||
<a href="https://laracasts.com">Laracasts</a>
|
||||
<a href="https://laravel-news.com">News</a>
|
||||
<a href="https://blog.laravel.com">Blog</a>
|
||||
<a href="https://nova.laravel.com">Nova</a>
|
||||
<a href="https://forge.laravel.com">Forge</a>
|
||||
<a href="https://vapor.laravel.com">Vapor</a>
|
||||
<a href="https://github.com/laravel/laravel">GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|
@ -13,6 +11,30 @@ use Illuminate\Support\Facades\Route;
|
|||
|
|
||||
*/
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
if(env('APP_ENV') === 'production' || env('APP_ENV') === 'testing'){
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
|
||||
Route::group(['middleware' => 'permissions:SHARE'], function(){
|
||||
Route::get('/', function () {
|
||||
return view('home');
|
||||
})->name('home');
|
||||
|
||||
Auth::routes();
|
||||
|
||||
//authenticated user only pages
|
||||
Route::group(['middleware' => 'auth'], function() {
|
||||
Route::get('/mode', function () {
|
||||
if(session("adminmode")){
|
||||
session()->put("adminmode",false);
|
||||
return redirect()->back();
|
||||
}else{
|
||||
session()->put("adminmode",true);
|
||||
return redirect()->back();
|
||||
}
|
||||
})->name('mode');
|
||||
});
|
||||
|
||||
Route::resource('users','UserController');
|
||||
Route::resource('roles','RoleController');
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue