/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $encryptor = app('Illuminate\\Encryption\\Encrypter'); $encryptorToken = $encryptor->encrypt(csrf_token()); $allPosts = job::latest('created_at')->get(); return view('user.index', compact('allPosts', 'encryptorToken')); }
private function initHandShake($thebidId) { $thebid = bid::where('bidId', $thebidId)->take(1)->get()->toArray(); $theJob = job::where('jobpost_id', $thebid[0]['job_id'])->first(); $theBidder = $thebid[0]['bidder_id']; $bidderChannel = 'private-theU' . $theBidder; $user = $theJob->user->id; $UserChannel = 'private-theU' . $user; $this->privatePusher->trigger($UserChannel, 'inithandshake', ['node' => $bidderChannel]); $this->privatePusher->trigger($bidderChannel, 'inithandshake', ['node' => $UserChannel]); }
public function placeOnMap(Request $request) { // This json thing was so confusing if ($request->json()) { $thePosts = job::all(['location', 'type', 'title', 'jobpost_id', 'content']); return response()->json($thePosts->toArray()); } else { return response('Unauthorized', 401); } }
public function getComplete(Request $request) { $jlink = $request->segment(4); $job = \App\job::where('id', $jlink); $job2 = $job->get()[0]; $job2->completed = 1; $job2->update(); $link = $request->segment(2); return redirect()->action('plan@getLink', [$link]); }
/* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', ['middleware' => 'guest', 'uses' => 'PagesController@index']); Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']); Route::get('/userlogin', ['middleware' => 'auth', 'uses' => 'UserController@index']); Route::get('/mapThePosts', 'PostsController@placeOnMap'); Route::post('/saveGeneralPost', 'PostsController@storeGeneralPost'); Route::post('/saveFoodPost', 'PostsController@storeFoodPost'); Route::post('/saveVicePost', 'PostsController@storeVicePost'); Route::post('/saveTransportPost', 'PostsController@storeTransportPost'); Route::post('/userlogin/bidpost', 'BidController@store'); Route::get('/userlogin/bidpost/getbids/{id}', 'BidController@show'); Route::post('/userlogin/mychannel', 'BidController@pusherAuth'); Route::post('/userlogin/dojob/{id}', 'BidController@dojob'); Route::post('/userlogin/accept', 'BidController@accept'); Route::post('/userlogin/message', 'BidController@relayMessage'); Route::get('/home', function () { redirect('/userlogin'); }); Route::get('/testing', function () { dd(\App\job::all()->toArray()); });