Exemplo n.º 1
0
 public function paper(Request $request)
 {
     $this->validate($request, ['id' => 'required', 'type' => 'required|in:1,-1']);
     $user = Auth::user();
     $id = $request->input('id');
     $value = $request->input('type');
     $paper = Paper::find($id);
     $isLiked = $this->commit($user, $paper, $id, $value);
     return ['hasCallback' => 1, 'callback' => 'paper_liked', 'hasMsg' => 0, 'msg' => '', 'msgType' => '', 'returns' => ['num_like' => $paper->num_like, 'num_dislike' => $paper->num_dislike, 'is_liked' => $isLiked]];
 }
Exemplo n.º 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $paper = Paper::find($id);
     $invoice = \DB::table("invoicing")->where("job_paper_size", "=", $paper->name)->get();
     if (count($invoice) > 0) {
         return response()->json("This Record cannot be deleted!<br>Bill Transactions is already existing against this site");
         exit;
     }
     if ($paper->delete()) {
         Session::flash("success_message", "Record Successfully deleted");
         echo "Paper Successfully Deleted";
         exit;
     }
 }
Exemplo n.º 3
0
 public function updatePaper(Request $request)
 {
     Paper::find($request->input('pk'))->update([$request->input('name') => $request->input('value')]);
 }