jeudi 22 février 2018

Trying to get property of non-object Dropbox API

I have a trouble with web app that enables users to send us a pdf files. We use dropbox and I have followed this guide - https://murze.be/dropbox-will-turn-off-v1-of-their-api-soon-its-time-to-update-your-php-application to update in regards to the API change. But as soon as I try to send a file to our dropbox account I get this error inside the Laravel log file.

    [2018-02-22 16:01:58] production.ERROR: ErrorException: Trying to get property of non-object in D:\home\site\app\Karierosfera\Users\User.php:153

And here's the function that has an error

public static function addCV(UploadedFile $file, User $user)
{
    $upload = new static;

    $upload->name =
    'Karierosfera ' . date('Y')
    . '/' .
    'CV'
    . '/' .
    str_slug($user->field->name)
    . '/' .
    str_slug($user->city->name)
    . '/' .
    str_slug("{$user->id}-{$user->firstname}-{$user->lastname}")
    . '.' .
    $file->getClientOriginalExtension();

    Storage::disk('dropbox')->put($upload->name, file_get_contents($file));

    $user->user_cv = $upload->name;
    $user->save();

    return $upload;



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire