public function run() { DB::table('Bookmark')->delete(); //DB::statement("TRUNCATE TABLE role_user"); //DB::statement("TRUNCATE TABLE Users"); Bookmark::create(array('name' => 'Bogor', 'x_min' => 106.604388339, 'y_min' => -6.71663787, 'x_max' => 107.003690281, 'y_max' => -6.438022028, 'wkid' => 4326)); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // $post = \App\Bookmark::find($id); $post->delete(); return $post; }
public function viewAllBookmark() { $admin = \Auth::user(); $bookmark = Bookmark::all(); $title = 'Bookmark List'; return view('bookmark.index')->with('bookmarks', $bookmark)->with('title', $title)->with('admin', $admin); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $bookmark = Bookmark::findOrFail($id); $this->authorize('update-destroy', $bookmark); $bookmark->delete(); return $bookmark; }
/** * Run the database seeds. * * @return void */ public function run() { Tag::truncate(); User::truncate(); Bookmark::truncate(); DB::table('bookmark_tag')->truncate(); // Start with 10 users, then iterate through each one to populate the other tables $users = factory(App\User::class, 50)->create(); $users->each(function ($user) { // Create a variable number of bookmarks/tags and persist them to the DB. // saveMany() automatically associates them with the current user_id. $bookmarks = factory(App\Bookmark::class, rand(2, 5))->make(); $user->bookmarks()->saveMany($bookmarks); $tags = factory(App\Tag::class, rand(2, 5))->make(); $user->tags()->saveMany($tags); // Everything is populated now except the bookmark_tag pivot table. // For that we need another loop. $tags->each(function ($tag) use($bookmarks) { for ($i = 0; $i < rand(1, 3); $i++) { // Select a random bookmark from the $bookmarks collection, // then attach the tag only IF the tag has not already been attached // to that bookmark. $bookmark = $bookmarks[rand(0, $bookmarks->count() - 1)]; if (!$bookmark->tags()->where('tag_id', $tag->id)->exists()) { $bookmark->tags()->attach($tag); } } }); }); }
public function link($id) { $bookmark = Bookmark::findOrFail($id); $bookmark->hit_cnt = $bookmark->hit_cnt + 1; $bookmark->save(); return redirect($bookmark->url); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); \App\User::truncate(); \App\Bookmark::truncate(); $this->call(BookmarkTableSeeder::class); $this->call(UserTableSeeder::class); Model::reguard(); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $bookmark = \App\Bookmark::find($id); if ($bookmark->user_id == Auth::user()->id) { $bookmark->delete(); } else { return response("Unauthorized", 403); } return $bookmark; }
public function GetBookmark() { $bookmarks = Bookmark::all(); $extent = array(); $name = array(); $bookmark = array(); $array = array(); foreach ($bookmarks as $key => $value) { $extent['xmin'] = (double) $value['x_min']; $extent['ymin'] = (double) $value['y_min']; $extent['xmax'] = (double) $value['x_max']; $extent['ymax'] = (double) $value['y_max']; $extent['spatialReference']['wkid'] = (int) $value['wkid']; $bookmark['extent'] = $extent; $bookmark['name'] = $value['name']; array_push($array, $bookmark); } return json_encode($array); }
public function update(Request $request, $id) { $session_id = Session::getId(); if (!$session_id) { return response('', 400); } $this->validate($request, ['id' => 'required|integer']); $bookmark = Bookmark::find($id); if ($request->bookmark) { $bookmark->bookmark = $request->bookmark; $bookmark->save(); } if ($request->bookmarked_at) { $bookmarked_at = new Carbon($request->bookmarked_at, auth()->user()->timezone); $bookmarked_at->setTimezone('UTC'); $bookmark->bookmarked_at = $bookmarked_at->toDateTimeString(); $bookmark->save(); } return response('', 204); }
public function delete($id) { $model = Bookmark::find($id); $model->delete(); }
public function destroy($id) { $bookmark = Bookmark::find($id); $bookmark->delete(); return Response::json('Note Deleted', 200); }
public function show($id) { $bookmark = Bookmark::findOrFail($id); return view('bookmarks.show', compact('bookmark')); }
protected function create(array $data) { $userID = Auth::user()->id; //dd($data); return Bookmark::create(['owner_id' => $userID, 'title' => $data['title'], 'url' => $data['url'], 'content' => $data['content'], 'colour' => $data['colour']]); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $bookmark = App\Bookmark::find($request->bookmark_id); $tag = App\Tag::find($request->tag_id); $bookmark->tags()->attach($tag); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $data = Bookmark::all(); return response()->json($data, 200, array(), JSON_PRETTY_PRINT); }
public function update(Bookmark $bookmark) { $statement = $this->connection->prepare('UPDATE bookmarks SET data = :data WHERE uuid = :uuid;'); $statement->execute(array(':uuid' => (string) $bookmark->getUuid(), ':data' => json_encode($bookmark->getData()))); return $bookmark; }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('bookmarks')->delete(); Bookmark::create(['name' => 'Luke Skywalker', 'menu_type' => 'yup', 'item_type' => '127.0.0.1', 'item_id' => 'MAC OSX', 'user_id' => '1']); }
$bookmark->name = $request->name; $bookmark->url = $request->url; $bookmark->description = trim($request->description); $bookmark->save(); return redirect('/home'); } else { return redirect('/'); } }); /** * DELETE /bookmark/{id} * Delete the bookmark at the associated {id} */ Route::delete('/bookmark/{id}', function ($id) { if (Auth::check()) { $bookmark = Bookmark::findOrFail($id); $bookmark->categories()->detach(); $bookmark->delete(); return redirect()->back(); } else { return redirect('/'); } }); /** * POST /send-message * Send a message to another user */ Route::post('/send-message', function (Request $request) { if (Auth::check()) { $target_user = User::findOrFail($request->user_id); $notify = new Notification();
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $bookmark = App\Bookmark::find($id); $bookmark->delete(); return $bookmark; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Bookmark::where('id', $id)->where('user_id', Auth::user()->id)->delete(); Tag::where('bookmark_id', $id)->delete(); }
public function setBookmark(Request $request) { $session_id = Session::getId(); if (!$session_id) { return response('', 400); } $this->validate($request, ['lesson_id' => 'required|integer', 'bookmark' => 'required|string']); $bookmark = new Bookmark(); $bookmark->lesson_id = $request->lesson_id; $bookmark->bookmark = $request->bookmark; $bookmark->save(); return response('', 201); }