I am new to laravel and when created a route, this error is displayed. I am passing complete parameters and can't locate the error.
Here's the route:
Route::get('/admin/claim_card/{giftcard_id}/{layout_id}/{user_id}/{color_id}' , 'UserController@claim_card')->name('claim_card');
Here's the function:
public function claim_card($giftcard_id , $layout_id , $user_id , $color_id)
{
$card = giftcard_codes::where([['is_active', '=' , 1], ['giftcard_id', '=' ,$giftcard_id], ['layout_id', '=' ,$layout_id]])->first();
if ($card) {
$user = User::where('id', $user_id)->first();
$lay = point_prizes::where('id', $layout_id)->first();
if ($user->points >= $lay->points) {
$us['points'] = $user->points - $lay->points;
$c['is_active'] = 0;
$co['color_id'] = $color_id;
$co['is_pending'] = 2;
cliaim_prizes_transactions::where([['user_id' , $user_id] , ['giftcard_id' , $giftcard_id] , ['layout_id' , $layout_id]])->first()->update($co);
$al = new user_alerts();
$al->user_id = $user_id;
$al->alert = 'Successfully Claimed Giftcard';
$al->alert_main = $card->code;
$al->save();
redeem__requests::where([['giftcard_id' , $giftcard_id] , ['layout' , $layout_id] , ['user_id' , $user_id] , ['is_active' , 1]])->first()->update($c);
giftcard_codes::where([['is_active', 1], ['giftcard_id', $giftcard_id], ['layout_id', $layout_id]])->orderby('id', 'DESC')->first()->update($c);
return view('admin.redeem_requests' , ['data' => redeem__requests::where('is_active' , 1)->get() , 'alert' => 'Giftcard Given Successfully']);
}
}
else {
return view('admin.redeem_requests' , ['data' => redeem__requests::where('is_active' , 1)->get() , 'alert' => 'No Code Exists']);
}
}
Here's the view(where I am passing these):
<a href="">
Any help would be appreciated.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3hRuxw0
via IFTTT
Aucun commentaire:
Enregistrer un commentaire