I want create update data from table users with field kupon, so project enduser have kupon 100 and then enduser can input to field car, motor for input kupon from he have 100 kupon. Logic car<=kupon
.
Controller
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('lucky');
}
public function update()
{
$users = Users::get();
foreach ($users as $user) {
$user->umroh = umroh;
$user->save();
}
}
Views
<form action="/lucky.update" method="post">
{{ csrf_field() }}
<input type="hidden" name="_method" value="PUT">
<label for="umroh"> umroh</label>
<input type="number" value="{{$user->umroh}}"><br>
<input type="submit" name="submit" value="edit">
</form>
Route
Auth::routes();
Route::resource('lucky', 'LuckyController');
somebody help me. I have time only 42 hour begin this post.