Example #1
0
 /**
  * Get Elements that are not linked to the Layout ID provided.
  *
  * @param  \Layout ID
  */
 public function getUnlinkedElements($id)
 {
     //Find all elements related to a Layout
     $linkedElements = LayoutsController::getElements($id);
     //Get the elements that are related to id
     $linkedElementsId = $linkedElements->lists('id');
     if (count($linkedElementsId) == 0) {
         //If there is no related elements, return all available elements.
         return Element::all();
     } else {
         //If there is related elements, find the ones that are not related
         return Element::whereNotIn('id', $linkedElementsId)->get();
     }
 }