app/Models/User.php
/**
     * Add new profile picture
     *
     * @param $file
     */
Add new profile picture
@param $file
Add new profile picture @param $file
public function addProfilePicture($file)
    {
        $album = $this->profile_album;
        if (! $album) {
            $album = $this->albums()->create([
                'type'  => 'profile',
                'title' => trans('albums.profile-pictures'),
            ]);
        }
        $item = $album->items()->create([]);
        $media = $item->addMedia($file)->toCollection();
        $this->update(['picture_media_id' => $media->id]);
    }
public function addProfilePicture ( $ file ) { $ album = $ this -> profile_album ; if ( ! $ album ) { $ album = $ this -> albums ( ) -> create ( [ 'type' => 'profile' , 'title' => trans ( 'albums.profile-pictures' ) , ] ) ; } $ item = $ album -> items ( ) -> create ( [ ] ) ; $ media = $ item -> addMedia ( $ file ) -> toCollection ( ) ; $ this -> update ( [ 'picture_media_id' => $ media -> id ] ) ; }
Add new profile picture
 @param $file
Add new profile picture @param $file
// Create Profile pictures album