mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
Edit Item DB structure
This commit is contained in:
85
app/Http/Controllers/ItemCategoryController.php
Normal file
85
app/Http/Controllers/ItemCategoryController.php
Normal 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)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,8 +18,17 @@ class Item extends Model
|
|||||||
return $col_items;
|
return $col_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'metadata' => 'array',
|
||||||
|
];
|
||||||
|
|
||||||
public function bookings()
|
public function bookings()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Booking');
|
return $this->hasMany('App\Booking');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function category()
|
||||||
|
{
|
||||||
|
return \App\ItemCategory::find($this->category_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
app/ItemCategory.php
Normal file
13
app/ItemCategory.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,9 +15,12 @@ class CreateItemsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('items', function (Blueprint $table) {
|
Schema::create('items', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
|
$table->integer('category_id');
|
||||||
$table->integer('quantity');
|
$table->integer('quantity');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->string('official_number');
|
||||||
$table->string('desc');
|
$table->string('desc');
|
||||||
|
$table->text('metadata');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateItemCategoriesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('item_categories', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('desc');
|
||||||
|
$table->boolean('is_training');
|
||||||
|
$table->boolean('is_op_appro');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('item_categories');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,7 +69,6 @@
|
|||||||
<p> Horaire</p>
|
<p> Horaire</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<!--
|
|
||||||
<li class="nav-item ">
|
<li class="nav-item ">
|
||||||
<a class="nav-link" data-toggle="collapse" href="#inventory">
|
<a class="nav-link" data-toggle="collapse" href="#inventory">
|
||||||
<i class="material-icons">shopping_basket</i>
|
<i class="material-icons">shopping_basket</i>
|
||||||
@@ -99,7 +98,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>-->
|
</li>
|
||||||
<li class="nav-item ">
|
<li class="nav-item ">
|
||||||
<a class="nav-link" data-toggle="collapse" href="#inventory">
|
<a class="nav-link" data-toggle="collapse" href="#inventory">
|
||||||
<i class="material-icons">image</i>
|
<i class="material-icons">image</i>
|
||||||
|
|||||||
Reference in New Issue
Block a user