public function store(Requests\CreateBinRequest $request) { $license = License::whereLicense($request->get('license'))->first(); if ($license->used == 1) { return redirect()->route('user.bins.index')->with('Error', 'Licentie is al in gebruik'); } $license->used = 1; $license->save(); auth()->user()->addLicense($license); return redirect()->route('user.bins.index')->with('Success', 'Licentie is toegevoegd'); }
public function addScore($license, $points) { $lic = License::whereLicense($license)->first(); if ($lic == null) { return new JsonResponse(['Licentie bestaat niet, heeft u zich aangemeld?'], 200); } $score = new Score(); $score->license = $license; $score->score = $points; $score->save(); return new JsonResponse(['Gelukt'], 200); }