/** * Show the form for creating a new resource. * * @return Response */ public function newSpot() { $user_id = Input::get('user_id'); $iterinary_id = Input::get('iterinary_id'); $longitude = Input::get('longitude'); $latitude = Input::get('latitude'); $place_name = Input::get('place_name'); $city = Input::get('city'); $tips = Input::get('tips'); $price = Input::get('price'); $type = Input::get('type'); // $category $user = App\User::find($user_id); $iterinary = App\Iterinary::find($iterinary_id); }
}); Route::get('flush/session', function () { if (Input::get('token') == 'gokigoks') { Session::flush(); } }); Route::get('checksession', ['middleware' => 'cors', 'uses' => function () { $token = Input::get('token'); return response()->json(App\Classes\UserSessionHandler::getByToken($token), 200); }]); Route::get('iterinary/assign', function () { $user_id = Input::get('user'); $iterinary_id = Input::get('iterinary'); $status = !Input::get('status') ? 'doing' : Input::get('status'); $user = App\User::find($user_id); $iterinary = App\Iterinary::find($iterinary_id); $user->iterinaries()->attach($iterinary->id, ['status' => $status, 'date_start' => Carbon\Carbon::now()]); }); Route::get('checktoken', function () { $token = Input::get('token'); return Session::has($token); }); Route::get('days/getdiff', function () { $user = App\User::find(Input::get('user_id')); $iterinary_id = Input::get('iterinary_id'); $now = Carbon\Carbon::now(); $start_date = Carbon\Carbon::now()->subDays(2); $pivot = $user->iterinaries()->find($iterinary_id); $date = new Carbon($pivot->pivot->date_start); $day = $now->diffInDays($date); dd($day, $start_date, $now);