56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Incoming;
|
|
use App\Models\Option;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Support\Facades\Date;
|
|
|
|
class IncomingController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index(): View
|
|
{
|
|
if (Option::where('name', '=', 'incoming_from')->count() > 0) {
|
|
$first = Option::where('name', '=', 'incoming_from')->first()->value;
|
|
} else {
|
|
$first = Date::now()->firstOfMonth()->format('Y-m-d');
|
|
}
|
|
|
|
if (Option::where('name', '=', 'incoming_end')->count() > 0) {
|
|
$last = Option::where('name', '=', 'incoming_end')->first()->value;
|
|
} else {
|
|
$last = Date::now()->format('Y-m-d');
|
|
}
|
|
|
|
return view('incoming.index', ['first' => $first, 'last' => $last]);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create(): View
|
|
{
|
|
return view('incoming.create');
|
|
}
|
|
|
|
/**
|
|
* Show the form for uploading a new resource.
|
|
*/
|
|
public function upload(): View
|
|
{
|
|
return view('incoming.upload');
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(Incoming $incoming): View
|
|
{
|
|
return view('incoming.edit', ['incoming' => $incoming, 'supplier' => $incoming->supplier, 'items' => $incoming->items, 'taxes' => $incoming->taxes]);
|
|
}
|
|
}
|