balance_com <=0 ) return $this->errorResponse(trans('messages.empty_com_balance') , Response::HTTP_BAD_REQUEST); $wallet->balance_princ += $wallet->balance_com; $wallet->balance_com = 0; $wallet->save(); return $this->successResponse($wallet); } public function sendMail(){ $recipients = ['dietchidjery@gmail.com']; Mail::mailer('smtp')->raw('Message test.', function ($message) use ($recipients) { $message->subject('This is a test to see if emails are working'); $message->to($recipients); }); return $this->successResponse("mail envoye"); } public function fileUpload(Request $request) { // if ($request->hasFile('image')) { // $image = $request->file('image'); // $name = time().'.'.$image->getClientOriginalExtension(); // $destinationPath = storage_path('/storage'); // $image->move($destinationPath, $name); // // // return $this->successResponse("image envoye"); // } $response = null; $user = (object) ['image' => ""]; if ($request->hasFile('image')) { $original_filename = $request->file('image')->getClientOriginalName(); $original_filename_arr = explode('.', $original_filename); $file_ext = end($original_filename_arr); $destination_path = './upload/user/'; $image = 'U-' . time() . '.' . $file_ext; if ($request->file('image')->move($destination_path, $image)) { $user->image = '/upload/user/' . $image; return $this->successResponse($user); } else { return $this->errorResponse('Cannot upload file'); } } else { return $this->errorResponse('File not found'); } } }