Progress on order progress
This commit is contained in:
50
app/Http/Controllers/ServiceController.php
Normal file
50
app/Http/Controllers/ServiceController.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
use App\Models\Service;
|
||||
|
||||
class ServiceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Update a service
|
||||
*
|
||||
* @note: Route Middleware protects this path
|
||||
* @param Service $o
|
||||
* @return View|void
|
||||
*/
|
||||
public function update(Request $request,Service $o)
|
||||
{
|
||||
switch ($o->order_status) {
|
||||
case 'ORDER-SENT':
|
||||
if ($request->post()) {
|
||||
foreach (['reference','notes'] as $key) {
|
||||
$o->setOrderInfo($key,$request->post($key));
|
||||
}
|
||||
|
||||
$o->save();
|
||||
|
||||
foreach ($request->post($o->stype) as $k=>$v) {
|
||||
$o->type->{$k} = $v;
|
||||
}
|
||||
|
||||
$o->type->save();
|
||||
|
||||
return redirect()->to(url('u/service',$o->id))->with('updated','Order sent notes updated.');
|
||||
}
|
||||
|
||||
return $this->update_order_status($o);
|
||||
|
||||
default:
|
||||
abort(499,'Not yet implemented');
|
||||
}
|
||||
}
|
||||
|
||||
private function update_order_status(Service $o)
|
||||
{
|
||||
return View('r.service.order.sent',['o'=>$o]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user