/**
  * {@inheritdoc}
  */
 public function handle(ServerRequestInterface $request)
 {
     $this->assertAdmin($request->getAttribute('actor'));
     $order = array_get($request->getParsedBody(), 'order');
     foreach ($order as $i => $link) {
         Link::where('id', $link['id'])->update(['position' => $i]);
     }
     return new EmptyResponse(204);
 }
Ejemplo n.º 2
0
 /**
  * Find a link by ID
  *
  * @param int $id
  * @param User $actor
  * @return Link
  * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
  */
 public function findOrFail($id, User $actor = null)
 {
     return Link::where('id', $id)->firstOrFail();
 }