Exemple #1
0
 /**
  * changeApiCredentialsView.
  *
  * [REQUEST] - GET
  *
  * the view for the api credential setting.
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function changeApiCredentialsView()
 {
     $data['title'] = 'Account settings -' . Auth::user()->name;
     $data['query'] = Trips::where('user_id', Auth::user()->id)->get();
     $data['tab'] = 2;
     return view('backend.profile', $data);
 }
Exemple #2
0
 /**
  * interested.
  *
  * @param intrestValidation $request
  * @param int               $tripId  , The id of the trip.
  */
 public function intrested(intrestValidation $request, $tripId)
 {
     $trip = Trips::findOrfail($tripId);
     $data = $request->all();
     // Mail trip owner
     Mail::queue('emails.intrested_owner', $data, function ($message) use($trip) {
         $message->from('topairy@gmail.com', 'Solidarity for all - TRIPS');
         $message->subject('Iemand heeft intresse om mee te rijden.');
         $message->to($trip->email);
     });
     // TODO: Debug the commented code.
     // Mail intrested person.
     // Mail::queue('emails.intrested_person', $data, function($message) use ($request) {
     //    $message->from('topairy@gmail.com', 'Solidarity for all - TRIPS');
     //    $message->to($request->email);
     // });
     // Set flash message
     session()->flash('flash_title', 'Success!');
     session()->flash('flash_message', 'We hebben de eigenaar een berichtt gestuurd. hij zal spoedig contact met je opnemen');
     session()->flash('flash_message_important', true);
     return Redirect::back();
 }
 /**
  * Update.
  *
  * Update a resource.
  *
  * @param int $tripId , The user id.
  *
  * @return JSON resporns
  */
 public function update(Request $request, $tripId)
 {
     if (auth()->gaurd('api')->user()->id != $trip->user_id) {
         $returnData = [];
         return response()->json($returnData)->header('Content-Type', 'application/json', 200);
     }
     $trip = Trips::find($tripId);
     $trip->region = $request->region;
     $trip->destination = $request->destination;
     $trip->date = strtotime($request->date);
     // UNIX timestamp.
     $trip->name = $request->name;
     $trip->email = $request->email;
     $trip->telephone = $request->telephone;
     $trip->places = $request->places;
     $trip->save();
     $returnData = [];
     return response()->json($returnData)->header('Content-Type', 'application/json', 200);
 }