O'Reilly logo

Learning Laravel 4 Application Development by Hardik Dangar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding credit for the user

Jordan said he wanted to give credits to some of his early users as well as buyers who would purchase Foldagram in large quantities. We need to create a form where the admin can select a user from the dropdown and add a number of credits to that account. When they have credits, they can buy Foldagrams with those credits without paying via credit card.

Let's write a Controller method to first fetch all users and render the View file:

public function getusercredit() { $users = Sentry::user()->all(); $userarray = array(); foreach($users as $value){ $userarray[$value['id']] = $value['email']; } return View::make('admin.user_credit')->with('title','Foldagram - Admin') ->with("page_title","Give User Credit") ->with('users',$userarray) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required