Allow syndication links to be updated more easily/reliably bu casting syndicates to array
This commit is contained in:
parent
bab7074316
commit
8e113ce3d0
3 changed files with 15 additions and 2 deletions
|
@ -13,6 +13,15 @@ class Bookmark extends Model
|
||||||
*/
|
*/
|
||||||
protected $fillable = ['url', 'name', 'content'];
|
protected $fillable = ['url', 'name', 'content'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'syndicates' => 'array',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The tags that belong to the bookmark.
|
* The tags that belong to the bookmark.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,7 +47,9 @@ class SyndicateBookmarkToFacebook implements ShouldQueue
|
||||||
//parse for syndication URL
|
//parse for syndication URL
|
||||||
if ($response->getStatusCode() == 201) {
|
if ($response->getStatusCode() == 201) {
|
||||||
$json = json_decode((string) $response->getBody());
|
$json = json_decode((string) $response->getBody());
|
||||||
$this->bookmark->update(['syndicates->facebook' => $json->url]);
|
$syndicates = $this->bookmark->syndicates;
|
||||||
|
$syndicates['facebook'] = $json->url;
|
||||||
|
$this->bookmark->syndicates = $syndicates;
|
||||||
$this->bookmark->save();
|
$this->bookmark->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,9 @@ class SyndicateBookmarkToTwitter implements ShouldQueue
|
||||||
//parse for syndication URL
|
//parse for syndication URL
|
||||||
if ($response->getStatusCode() == 201) {
|
if ($response->getStatusCode() == 201) {
|
||||||
$json = json_decode((string) $response->getBody());
|
$json = json_decode((string) $response->getBody());
|
||||||
$this->bookmark->update(['syndicates->twitter' => $json->url]);
|
$syndicates = $this->bookmark->syndicates;
|
||||||
|
$syndicates['twitter'] = $json->url;
|
||||||
|
$this->bookmark->syndicates = $syndicates;
|
||||||
$this->bookmark->save();
|
$this->bookmark->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue