Edit Item DB structure

This commit is contained in:
Mathieu Lagace
2019-08-27 13:36:55 -04:00
parent 615752d61a
commit 509a135e74
6 changed files with 146 additions and 2 deletions

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\ItemCategory;
use Illuminate\Http\Request;
class ItemCategoryController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\ItemCategory $itemCategory
* @return \Illuminate\Http\Response
*/
public function show(ItemCategory $itemCategory)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\ItemCategory $itemCategory
* @return \Illuminate\Http\Response
*/
public function edit(ItemCategory $itemCategory)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\ItemCategory $itemCategory
* @return \Illuminate\Http\Response
*/
public function update(Request $request, ItemCategory $itemCategory)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\ItemCategory $itemCategory
* @return \Illuminate\Http\Response
*/
public function destroy(ItemCategory $itemCategory)
{
//
}
}

View File

@@ -18,8 +18,17 @@ class Item extends Model
return $col_items;
}
protected $casts = [
'metadata' => 'array',
];
public function bookings()
{
return $this->hasMany('App\Booking');
}
public function category()
{
return \App\ItemCategory::find($this->category_id);
}
}

13
app/ItemCategory.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class ItemCategory extends Model
{
public function items()
{
return $this->hasMany('App\Item','category_id');
}
}