如果我有一个Instagram帖子,那么无论如何获得Instagram帖子的Facebook ID?需要说明的是,如果我查看https://www.instagram.com/p/Bcqn51ynrd5/,我可以通过以下两种方式之一找到instagram media-id:
但是,这些都不是与facebook的新Instagram图表见解相关的媒体ID .如果我已经拥有facebook media-id,我可以通过调用获取Instagram media-id到facebook图,graph.facebook.com/{facebook-media-id}?fields=ig_id但我无法找到反向.这可能吗?
是否可以更新时间戳(除此之外updated_at)并在一个查询中增加列?我显然可以->increment('count')和单独->update(['last_count_increased_at' => Carbon::now()])但是有一个简单的方法来做到这两者.
Product::where('product_id', $product->id)
->update(['count'=>count+1, 'last_count_increased_at' => Carbon::now()];
无需先查询并获取计数?
我已经尝试了所有可能性来获取Instagram发布的媒体帖子的见解.这是我试图获得见解的帖子 -
https://api.instagram.com/oembed/?url=https://www.instagram.com/p/BUs4jxfAtIs/
很明显,Instagram提供的端点不足以获得任何类型的洞察数据.
当我尝试使用graph api时,
v2.9/1525843122691691052_5512691375/insights
我收到一个错误:
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: 1525843122691691052_5512691375",
"type": "OAuthException",
"code": 803,
"fbtrace_id": "A64kR4gnbfC"
}
}
Run Code Online (Sandbox Code Playgroud)
这甚至可能吗?有没有人能够做到这一点?该文档没有多大帮助,看起来不是最新的.
facebook-graph-api instagram facebook-insights instagram-api
每当使用Spotify播放器时,我们会遇到持续大约十秒钟的口吃.虽然有一些方面对我来说似乎不正常但是它发生的最一致的标志是我们didStartPlayingTrack不止一次地击中委托方法,即使我们只告诉玩家玩一次.有没有人有任何想法会导致这种情况发生?
重要提示:这是 spotify-ios-sdk version 0.21
日志样本:
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyTrackDelivered") // Last track ended
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyAudioDeliveryDone")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyPause")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyMetadataChanged")
movePlayerPosition(_:completion:)[L:180]: seek successful to 0.842
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyMetadataChanged")
13:13:50 audioStreaming(_:didStartPlayingTrack:)[L:377]: didStartPlayingTrack: Optional("So Far Away (Live) - Live")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyTrackChanged")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackEventAudioFlush")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyPlay")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyMetadataChanged")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyMetadataChanged")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyContextChanged")
13:14:01 audioStreaming(_:didStartPlayingTrack:)[L:377]: didStartPlayingTrack: Optional("So Far Away (Live) - Live")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyTrackChanged")
audioStreaming(_:didSeekToPosition:)[L:474]: did seek to position: 0.001
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackEventAudioFlush") …Run Code Online (Sandbox Code Playgroud) 我的搜索表单有一个SQL查询.
$term = $request->get('term');
$queries = Article::where('title', 'LIKE', '%' . $term . '%')->published()->get();
Run Code Online (Sandbox Code Playgroud)
我的研究正在进行中.如果我有一篇名为"我的伟大文章很棒"的文章,并且我在我的搜索表单中写了"greate article",它就可以了.
但是,如果我写"文章真棒",这些词语就不会互相影响,而且它不起作用.
如何使我的查询仅使用关键字?
谢谢
我有以下关系:
我有以下Eloquent模型来代表这一点:
class Venue {
public function orders()
{
return $this->hasManyThrough(Order::class, Offer::class);
}
}
Run Code Online (Sandbox Code Playgroud)
我想location_id = 5使用Laravel的Eloquent模型确定场地的总订单数。
我设法做到这一点的唯一方法如下:
$venues = Venue::where('location_id', 5)->with('orders')->get();
$numberOfOrders = 0;
foreach($venues as $venue) {
$numberOfOrders += $venue->orders->count();
}
dump($numberOfOrders); // Output a single number (e.g. 512)
Run Code Online (Sandbox Code Playgroud)
但是,这显然不是很有效,因为我是使用PHP而不是SQL计算计数。
我如何单独使用Eloquent模型来做到这一点。
我有一个仅用于 ajax 路由的中间件。
// AjaxOnly Middleware class
public function handle($request, Closure $next)
{
if (!$request->ajax()) {
// dd('I\'m (condition) working as expected!');
return response()->view('layouts.app');
}
dd('I never work!');
return $next($request);
}
Run Code Online (Sandbox Code Playgroud)
这是我的路线 web.php
// Ajax only routes
Route::group(['middleware' => 'ajaxOnly'], function () {
// Work an print 'false'
// dd(Request::ajax());
// Redirect me to /login page
Route::group(['middleware' => ['auth:user']], function () {
Route::get('/', 'HomeController@index')->name('home');
});
// Authentication routes
Auth::routes();
});
Run Code Online (Sandbox Code Playgroud)
那么,有人可以解释为什么代码继续在中间件保护的闭包内运行吗?谢谢。
UPD:澄清一下 -
在事件上使用时是否有一种简单的方法来有条件地广播implement ShouldBroadcast?例如:
/**
* Get the channels the event should be broadcast on.
*
* @return array
*/
public function broadcastOn()
{
if ($x == 2) return;
return ['test_channel'];
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,上面的代码仍然创建排队作业,它没有成功并继续尝试它,但不能,因为它没有通道名称。有没有一种简单的方法来抑制正在创建的工作$x == 2?