app/Category.php
/**
     * check that the passed categories are available in db
     *
     * @param array $categories
     * @return bool|\Illuminate\Support\Collection of valid categories|bool
     */
check that the passed categories are available in db
@param array $categories
@return bool|\Illuminate\Support\Collection of valid categories|bool
check that the passed categories are available in db @param array $categories @return bool| \ Illuminate \ Support \ Collection of valid categories|bool
public function areValidCategories(array $categories = []) {
        if ($categories === array_intersect($categories, $this->pluck('name')->toArray())) {
            return $this->where('name', $categories)->pluck('id');
        }
        return false;
    }
public function areValidCategories ( array $ categories = [ ] ) { if ( $ categories === array_intersect ( $ categories , $ this -> pluck ( 'name' ) -> toArray ( ) ) ) { return $ this -> where ( 'name' , $ categories ) -> pluck ( 'id' ) ; } return false ; }
check that the passed categories are available in db
 @param array $categories
 @return bool|\Illuminate\Support\Collection of valid categories|bool
check that the passed categories are available in db @param array $categories @return bool| \ Illuminate \ Support \ Collection of valid categories|bool