-
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.
- Loading branch information
1 parent
72b7a40
commit 69885da
Showing
26 changed files
with
871 additions
and
351 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
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,148 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\admin; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Models\admin\Book; | ||
use App\Models\admin\Layers; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Validator; | ||
use Illuminate\Support\Facades\Storage; | ||
|
||
class layersController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index() | ||
{ | ||
$items = Layers::all(); | ||
return view('admin.layers.home', | ||
[ | ||
'items' =>$items, | ||
]); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function create() | ||
{ | ||
return view('admin.layers.create'); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
// dd($request->all()); | ||
$request->validate([ | ||
'title_threats' => 'required|max:255', | ||
'layer' => 'required', | ||
'descriptions_threats' => 'required', | ||
'img_threats' => 'required |image|mimes:jpg,png', | ||
'title_protocol' => 'required', | ||
'descriptions_protocol' => 'required|', | ||
]); | ||
$layer = new Layers(); | ||
$layer->title_threats =$request->title_threats ; | ||
$layer->layer =$request->layer; | ||
$layer->descriptions_threats =$request->descriptions_threats ; | ||
$layer->img_threats =$request->img_threats ; | ||
$layer->title_protocol =$request->title_protocol ; | ||
$layer->descriptions_protocol =$request->descriptions_protocol ; | ||
|
||
if( $request->img_threats != Null){ | ||
$imgName = $layer->id.'_layer'.time().'.'.request()->img_threats->getClientOriginalExtension(); | ||
|
||
$request->img_threats->move('uploads/images/layers',$imgName); | ||
|
||
|
||
$layer->img_threats = $imgName; | ||
} | ||
|
||
$layer->save(); | ||
|
||
return redirect()->back(); | ||
} | ||
|
||
/** | ||
* 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) | ||
{ | ||
$layer = Layers::findOrFail($id); | ||
|
||
return view('admin.layers.edit' , compact('layer')); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function update(Request $request, $id) | ||
{ | ||
// dd($request->all()); | ||
|
||
$layer = Layers::findOrFail($id); | ||
$layer->title_threats =$request->title_threats ; | ||
$layer->layer =$request->layer; | ||
$layer->descriptions_threats =$request->descriptions_threats ; | ||
$layer->img_threats =$request->img_threats ; | ||
$layer->title_protocol =$request->title_protocol ; | ||
$layer->descriptions_protocol =$request->descriptions_protocol ; | ||
|
||
if( $request->img_threats != Null){ | ||
$imgName = $layer->id.'_layer'.time().'.'.request()->img_threats->getClientOriginalExtension(); | ||
|
||
$request->img_threats->move('uploads/images/layers',$imgName); | ||
|
||
|
||
$layer->img_threats = $imgName; | ||
} | ||
|
||
$layer->save(); | ||
|
||
return redirect()->route('layers.index') | ||
->with('success', 'Layers updated successfully'); | ||
|
||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function destroy($id) | ||
{ | ||
Book::findOrFail($id)->delete(); | ||
return redirect()->route('books.index') | ||
->with('success', 'Book Deleted Successfully'); | ||
} | ||
} |
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,31 @@ | ||
<?php | ||
|
||
namespace App\Models\admin; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
|
||
class Layers extends Model | ||
{ | ||
use SoftDeletes; | ||
protected $table = 'layers'; | ||
protected $guarded =[]; | ||
protected $hidden = ['created_at',' updated_at','deleted_at']; | ||
public function getLayer(){ | ||
if ($this -> layer == 1 ) | ||
return 'Application Layer' ; | ||
elseif ($this -> layer == 2) | ||
return 'Presentation Layer'; | ||
elseif ($this -> layer == 3) | ||
return 'Session Layer'; | ||
elseif ($this -> layer == 4) | ||
return 'Transport Layer'; | ||
elseif ($this -> layer == 5) | ||
return 'Network Layer'; | ||
elseif ($this -> layer == 6) | ||
return 'Data Link Layer'; | ||
else | ||
return 'Physical Layer' ; | ||
} | ||
|
||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.