mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
Add ItemCategory form
This commit is contained in:
@@ -29,6 +29,11 @@ class InventoryController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function management()
|
||||
{
|
||||
return view('admin.inventory.management');
|
||||
}
|
||||
|
||||
public function booking()
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Item;
|
||||
use App\ItemCategory;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -14,7 +15,7 @@ class ItemCategoryController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return view('admin.itemcategory.index',['categories' => ItemCategory::all()]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +25,7 @@ class ItemCategoryController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
return view('admin.itemcategory.add');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,9 +34,32 @@ class ItemCategoryController extends Controller
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store()
|
||||
{
|
||||
//
|
||||
$c = new ItemCategory();
|
||||
|
||||
$c->name = \request('name');
|
||||
$c->desc = \request('desc');
|
||||
if (\request('is_training') == 1)
|
||||
{
|
||||
$c->is_training = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$c->is_training = 0;
|
||||
}
|
||||
if (\request('is_op_appro') == 1)
|
||||
{
|
||||
$c->is_op_appro = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$c->is_op_appro = 0;
|
||||
}
|
||||
|
||||
$c->save();
|
||||
|
||||
return redirect('/admin/inventory/management/category/')->with('success','Catégorie ajouté avec succès');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,9 +79,9 @@ class ItemCategoryController extends Controller
|
||||
* @param \App\ItemCategory $itemCategory
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ItemCategory $itemCategory)
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
return view('admin.itemcategory.edit',['category' => ItemCategory::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,9 +91,32 @@ class ItemCategoryController extends Controller
|
||||
* @param \App\ItemCategory $itemCategory
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, ItemCategory $itemCategory)
|
||||
public function update($id)
|
||||
{
|
||||
//
|
||||
$c = ItemCategory::find($id);
|
||||
|
||||
$c->name = \request('name');
|
||||
$c->desc = \request('desc');
|
||||
if (\request('is_training') == 1)
|
||||
{
|
||||
$c->is_training = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$c->is_training = 0;
|
||||
}
|
||||
if (\request('is_op_appro') == 1)
|
||||
{
|
||||
$c->is_op_appro = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$c->is_op_appro = 0;
|
||||
}
|
||||
|
||||
$c->save();
|
||||
|
||||
return redirect('/admin/inventory/management/category/')->with('success','Catégorie modifié avec succès');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,8 +125,10 @@ class ItemCategoryController extends Controller
|
||||
* @param \App\ItemCategory $itemCategory
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ItemCategory $itemCategory)
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
$c = ItemCategory::find($id);
|
||||
|
||||
$c->delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user