本文整理汇总了PHP中app\Photo::createFromApi方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::createFromApi方法的具体用法?PHP Photo::createFromApi怎么用?PHP Photo::createFromApi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Photo
的用法示例。
在下文中一共展示了Photo::createFromApi方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bindFromResponse
public static function bindFromResponse(\App\Place &$place, &$stdPlace)
{
$timestamp = \Carbon\Carbon::now()->toDateTimeString();
$place->lat = $stdPlace->geometry->location->lat;
$place->lng = $stdPlace->geometry->location->lng;
$place->ext_id = $stdPlace->id;
$place->icon = $stdPlace->icon;
$place->name = $stdPlace->name;
$place->place_id = $stdPlace->place_id;
$place->reference = $stdPlace->reference;
$place->scope = $stdPlace->scope;
$place->vicinity = $stdPlace->vicinity;
$place->created_at = $timestamp;
$place->updated_at = $timestamp;
$place->rating = null;
if (property_exists($stdPlace, 'rating')) {
$place->rating = $stdPlace->rating;
}
if (property_exists($stdPlace, 'photos')) {
foreach ($stdPlace->photos as $photo) {
\App\Photo::createFromApi($place->id, $photo);
}
}
}