public static function hasOwnership($app, $ownershipPostID)
    {
        if($ownershipPostID) {
            if(isPostType($app)) {
                $checkDB = DB::table($app)
                  ->where('postID', $ownershipPostID)
                  ->where('createdByUserID', Auth::user()->userID)
                  ->count();
            }else{
                $class = 'App\\Models\\'.$app;
                $object = new $class();
                $checkDB = DB::table($object->table)
                  ->where($object->getKeyName(), $ownershipPostID)
                  ->where('createdByUserID', Auth::user()->userID)
                  ->count();
            }


            return ($checkDB) ? true : false;
        }
    }
public static function hasOwnership($app, $ownershipPostID)
    {
        if($ownershipPostID) {
            if(isPostType($app)) {
                $checkDB = DB::table($app)
                  ->where('postID', $ownershipPostID)
                  ->where('createdByUserID', Auth::user()->userID)
                  ->count();
            }else{
                $class = 'App\\Models\\'.$app;
                $object = new $class();
                $checkDB = DB::table($object->table)
                  ->where($object->getKeyName(), $ownershipPostID)
                  ->where('createdByUserID', Auth::user()->userID)
                  ->count();
            }


            return ($checkDB) ? true : false;
        }
    }
public static function hasOwnership ( $ app , $ ownershipPostID ) { if ( $ ownershipPostID ) { if ( isPostType ( $ app ) ) { $ checkDB = DB :: table ( $ app ) -> where ( 'postID' , $ ownershipPostID ) -> where ( 'createdByUserID' , Auth :: user ( ) -> userID ) -> count ( ) ; } else { $ class = 'App\\Models\\' . $ app ; $ object = new $ class ( ) ; $ checkDB = DB :: table ( $ object -> table ) -> where ( $ object -> getKeyName ( ) , $ ownershipPostID ) -> where ( 'createdByUserID' , Auth :: user ( ) -> userID ) -> count ( ) ; } return ( $ checkDB ) ? true : false ; } }
Checks if user has ownership in a particular post.

@param  string  $app             The name of the app. Ex: "post_service"
@param  integer $ownershipPostID The ID of the post we are checking for ownership
@return boolean
Checks if user has ownership in a particular post .