Updates to service updating - broadband
This commit is contained in:
@@ -10,6 +10,7 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\View\View;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
@@ -409,15 +410,28 @@ class ServiceController extends Controller
|
||||
* @param Request $request
|
||||
* @param Service $o
|
||||
* @return RedirectResponse
|
||||
* @todo This needs to be reworked, to take into account our different service types
|
||||
* @todo Add Validation
|
||||
*/
|
||||
public function update(Request $request,Service $o)
|
||||
{
|
||||
if ($request->post($o->product->category)) {
|
||||
$o->type->forceFill($request->post($o->product->category))->save();
|
||||
if ($o->type->validation()) {
|
||||
$validator = Validator::make($x=$request->post($o->category),$o->type->validation());
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()
|
||||
->back()
|
||||
->withErrors($validator)
|
||||
->withInput();
|
||||
}
|
||||
|
||||
$o->type->forceFill(Arr::except($x,['start_at']));
|
||||
|
||||
} elseif ($request->post($o->product->category)) {
|
||||
$o->type->forceFill($request->post($o->product->category));
|
||||
}
|
||||
|
||||
$o->type->save();
|
||||
|
||||
// Also update our service start_at date.
|
||||
if ($request->post('start_at'))
|
||||
$o->start_at = $request->start_at;
|
||||
|
||||
|
Reference in New Issue
Block a user