-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completed backend of profile administration. Worked on frontend, but …
…needs improvement.
Showing
99 changed files
with
1,004 additions
and
165 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
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,92 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Request; | ||
use Auth; | ||
|
||
use App\Http\Requests\PermissionRequest; | ||
use App\Permission; | ||
|
||
class PermissionController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index() | ||
{ | ||
$permissions = Permission::all(); | ||
|
||
return view("permission.index")->with("permissions", $permissions); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function create(){ | ||
return view("permission.add"); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function store(PermissionRequest $request) | ||
{ | ||
$permission = Permission::create(Request::all()); | ||
$this->index(); | ||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function show($id) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function edit($id) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function update(Request $request, $id) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function destroy($id) | ||
{ | ||
// | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Request; | ||
use App\Http\Requests; | ||
use Auth; | ||
use App\Profile; | ||
|
||
class UserController extends Controller { | ||
|
||
public function editName(Request $request, $id) { | ||
return route("profile.edit.name", $id); | ||
} | ||
|
||
public function editPhoto(Request $request, $id) { | ||
$file = Request::file('photo'); | ||
$random_name = str_random(8); | ||
$destinationPath = 'profiles/'; | ||
$extension = $file->getClientOriginalExtension(); | ||
$filename = $random_name . '_' . Auth::user()->id . '_' .Auth::user()->firstname. '_' .Auth::user()->lastname .'.' . $extension; | ||
$uploadSuccess = Request::file('photo')->move($destinationPath, $filename); | ||
if ($uploadSuccess) { | ||
$profile = Profile::find($id); | ||
$update = $profile->update(array('photo' => $filename)); | ||
|
||
|
||
return view("profile.index")->with("user", Auth::user()); | ||
} | ||
} | ||
|
||
} |
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,37 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
use Auth; | ||
|
||
class PermissionRequest extends FormRequest | ||
{ | ||
/** | ||
* Determine if the user is authorized to make this request. | ||
* | ||
* @return bool | ||
*/ | ||
public function authorize() | ||
{ | ||
if(Auth::check()){ | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
'user_type' => 'required', | ||
'permission_group' => 'required', | ||
'permission_name' => 'required', | ||
'auth_level' => 'required' | ||
]; | ||
} | ||
} |
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
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,16 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Permission_Profile extends Model | ||
{ | ||
protected $table = "permission_profile"; | ||
|
||
protected $fillable = [ | ||
'profile_id', 'permission_id' | ||
]; | ||
|
||
|
||
} |
Oops, something went wrong.