Ejemplo n.º 1
0
 public function process(BookInterface $book, User $user, $token)
 {
     $charge = $user->charge(number_format($book->price, 2, "", ""), ['source' => $token, 'receipt_email' => $user->email]);
     if ($charge) {
         Order::create(['user_id' => $user->id, 'book_id' => $book->id, 'price' => $book->price]);
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 public function revokeRole($id, $role_id)
 {
     $this->authorize('user_revoke_role');
     $user = User::find($id);
     $role = Role::findOrFail($role_id);
     $user->revokeRole($role);
     return redirect()->back();
 }
Ejemplo n.º 3
0
 public function before(User $user, $ability)
 {
     if ($user->can('book_manage_all')) {
         return true;
     }
 }