Answer the question
In order to leave comments, you need to log in
What is the best way to divide goods into warehouses?
Now I have done so
Goods
Route::get('/orders', 'admin\[email protected]');
Route::post('order-add', 'admin\[email protected]')->name('order-add');
Route::get('order-add', function () {
return view('cont.order-add');
})->name('order-add');
public function addorder(OrdersRequest $addord)
{
$addorder = new Orders();
$addorder->shop = $addord->input('shop');
$addorder->product = $addord->input('product');
$addorder->price = $addord->input('price');
$addorder->warehouses = $addord->input('warehouses');
$addorder->status = $addord->input('status');
$addorder->comment = $addord->input('comment');
$addorder->save();
return redirect('/orders')->with('success', 'Ордер Добавлен!');
}
public function orderlist()
{
$addorder = new Orders();
return view('cont.orders', ['allorder' => Orders::all()]);
}
@foreach ($allorder as $order)
<tr>
<td><a href="{{ route('order-one', $order->id) }}" class="btn btn-info">{{ $order->id }}</a></td>
<td>{{ $order->created_at }}</td>
<td>{{ $order->shop }}</td>
<td>{{ $order->product }}</td>
<td>{{ $order->price }}</td>
<td>{{ $order->warehouses }}</td>
<td>
<span class="badge-pill badge-primary">{{ $order->status }}</span>
</td>
<td>{{ $order->comment }}</td>
<td>
<a href="{{ route('order-update', $order->id) }}" class="btn btn-info"
><i class="fas fa-edit"><!-- --></i> </a>
</td>
</tr>
@endforeach
Route::get('warehouses', 'admin\[email protected]');
Route::post('/warehouses-add', 'admin\[email protected]')->name('warehouses-add');
Route::get('/warehouses-add', function () {
return view('work.warehouses-add');
});
public function addwarehouses(WarehousesRequest $addwrk)
{
$addwarehouses = new Warehouses();
$addwarehouses->name = $addwrk->input('name');
$addwarehouses->address = $addwrk->input('address');
$addwarehouses->phone = $addwrk->input('phone');
$addwarehouses->email = $addwrk->input('email');
$addwarehouses->comment = $addwrk->input('comment');
$addwarehouses->save();
return redirect("Control-Panel")->with('success', 'Склад Добавлен!');
}
public function warehouseslist()
{
$addwarehousesr = new Warehouses;
return view('work.warehouses', ['allwork' => Warehouses::all()]);
}
@foreach ($allwork as $work)
<tr>
<td><a href="{{ route('warehouses-one', $work->id) }}" class="btn btn-info">{{ $work->id }}</a></td>
<td>{{ $work->name }}</td>
<td class="hidden-sm-down">{{ $work->address }}</td>
<td>{{ $work->phone }}<br>{{ $work->email }}</td>
<td>{{ $work->comment }}</td>
<td>
<a href=""{{ route('warehouses-update', $work->id) }}" class="btn btn-info"
><i class="fas fa-edit"><!-- --></i></a>
</td>
</tr>
@endforeach
Answer the question
In order to leave comments, you need to log in
In the table with goods, you make a warehouse_id column where you write the warehouse id. In the models you create links and through with in the request you get all the goods of a certain warehouse. Read the documentation, everything is clear on the examples shown.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question