public function getAssignmentAttribute()
    {
        if (! $this->exists) {
            return static::ALL_PAGES;
        }

        $count = $this->menuPivot()->count();
        if ($count === 0) {
            return static::NO_PAGES;
        } elseif ($count > 1) {
            return static::SELECTED_PAGES;
        } elseif ($count === 1) {
            $pivot = $this->menuPivot()->first();
            if ($pivot->menu_id > 0) {
                return static::SELECTED_PAGES;
            }
        }

        return static::ALL_PAGES;
    }
public function getAssignmentAttribute()
    {
        if (! $this->exists) {
            return static::ALL_PAGES;
        }

        $count = $this->menuPivot()->count();
        if ($count === 0) {
            return static::NO_PAGES;
        } elseif ($count > 1) {
            return static::SELECTED_PAGES;
        } elseif ($count === 1) {
            $pivot = $this->menuPivot()->first();
            if ($pivot->menu_id > 0) {
                return static::SELECTED_PAGES;
            }
        }

        return static::ALL_PAGES;
    }
public function getAssignmentAttribute ( ) { if ( ! $ this -> exists ) { return static :: ALL_PAGES ; } $ count = $ this -> menuPivot ( ) -> count ( ) ; if ( $ count === 0 ) { return static :: NO_PAGES ; } elseif ( $ count > 1 ) { return static :: SELECTED_PAGES ; } elseif ( $ count === 1 ) { $ pivot = $ this -> menuPivot ( ) -> first ( ) ; if ( $ pivot -> menu_id > 0 ) { return static :: SELECTED_PAGES ; } } return static :: ALL_PAGES ; }
Get menu assignment attribute.

@return int
Get menu assignment attribute .