Example #1
0
 public function revoke($id)
 {
     Approval::where('request_id', $id)->where('user_id', Auth::user()->id)->delete();
     $approvals = Approval::getRecent($id);
     $status = array('Approve' => 0, 'Reject' => 0);
     foreach ($approvals as $approval) {
         $status[$approval->choice]++;
     }
     $sub = \App\Request::find($id);
     $this->updateStatus($sub, $status);
     return response()->json(['status' => 'success']);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $approval = Approval::where('id', $id)->delete();
 }
Example #3
0
 public function getApprovalsCountAttribute()
 {
     return Approval::where('user_id', $this->id)->count();
 }