Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SeoManager object error when seoManager variable is null #2

Closed
mshoaibdev opened this issue Jan 18, 2019 · 2 comments
Closed

SeoManager object error when seoManager variable is null #2

mshoaibdev opened this issue Jan 18, 2019 · 2 comments

Comments

@mshoaibdev
Copy link

When you don't have any data in SeoManger table for the current URI, it throws an error of the object, because it is null, for that you need to just check if it is empty just return a blank string. I don't know how to submit the PR.

to fixed the problem just add this after $metaData = [];
if(empty($seoManager)){
return '';
}

@karakhanyans
Copy link
Contributor

@mshoaibdev
Thanks for your response.
The issue is fixed.

@tomphilpotts
Copy link

I was getting a similar error too.

"Call to a member function uri() on null"

Added this check

private function getMetaData($property) {

    {

        $route = \Route::current();

        /*
         * Add this check, I was getting an error "Call to a member function uri() on null"
         * This was because it is a 404 page.
         */
        if (empty($route)) {
	        return "Error";
        }

	    $uri = $route->uri();

        $seoManager = SeoManager::where('uri', $uri)->first();
        if(is_null($seoManager)){
            return null;
        }
 //............
}

Seems to have fixed the issue.

karakhanyans added a commit that referenced this issue Jan 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants