我正在使用isp配置,但我所有的幼虫都在公共文件夹中,而iso配置指向一个web文件夹.
有谁知道我怎么能改变这个?
使用以下代码保存到数据库.Event是指自定义模型.
$currentEvent = new Event;
$currentEvent->end = $event['end_time'];
$currentEvent->save();
Run Code Online (Sandbox Code Playgroud)
这里save发生了什么- 与某些事情相冲突的方法?
我不知道如何在 laravel eloquent orm 中同时使用 update 和 limit 方法。
$affectedRows = Promo::where('used','=',0)
->update(array('user_id' => Auth::user()->id))
->limit(1); // Call to a member function limit() on a non-object
//->take(1); // Call to a member function take() on a non-object
Run Code Online (Sandbox Code Playgroud)
我尝试了 limit 和 take 方法。
我只想做一个结果就是更新。
但我认为,我不能在更新时使用限制或采取方法。
有没有办法通过 eloquent 只更新一行?
添加 :
雄辩的 ORM
$affectedRows = Promo::where('user_id','=',DB::raw('null'))->take(1)
->update(
array(
'user_id' => Auth::user()->id,
'created_ip' =>Request::getClientIp(),
'created_at' => new DateTime,
'updated_at' => new DateTime
)
);
Run Code Online (Sandbox Code Playgroud)
查询生成器
$affectedRows = DB::table('promos')->whereNull('user_id')
->take(1)
->update(array(
'user_id' => Auth::user()->id, …Run Code Online (Sandbox Code Playgroud) Laravel noob在这里.
我收到回复" 身份验证失败!Facebook返回了无效的用户ID. ".我相信我正确地遵循了这个例子.
1.我的Facebook登录网站设置为http://localhost.com
2. HybridAuth配置.Base url设置为http://localhost.com/laravel4/public/social/auth/
3.我尝试在同一台服务器上运行来自HybridAuth的示例,同样的facebook app id和app secrete; 除了使用Laravel框架之外,所有似乎都可以正常工作.
4.更新(Laravel 4和HybridAuth).
我很感激任何想法.
我使用laravel-oauth2包为Laravel 4设置Facebook登录.我正在使用这里看到的包:https: //github.com/madewithlove/laravel-oauth2
当运行控制登录的页面,public/oauth/facebook时,Facebook提示正常,但当我点击"接受"时,该页面会出现以下错误:
ErrorException
Argument 1 passed to OAuth2\Provider\Facebook::get_user_info() must be an instance of OAuth2\Token\Token_Access, instance of OAuth2\Token_Access given, called in /Applications/MAMP/htdocs/crowdsets/laravel-master/app/controllers/Oauth2Controller.php on line 36 and defined
Run Code Online (Sandbox Code Playgroud)
它指向 /vendor/taylorotwell/laravel-oauth2/src/OAuth2/Provider/Facebook.php: 26
get_user_info()Facebook.php中的功能如下所示:
public function get_user_info(Token_Access $token)
{
$url = 'https://graph.facebook.com/me?'.http_build_query(array(
'access_token' => $token->access_token,
));
$user = json_decode(file_get_contents($url));
// Create a response from the request
return array(
'uid' => $user->id,
'nickname' => $user->username,
'name' => $user->name,
'email' => $user->email,
'location' => $user->hometown->name,
'description' => $user->bio,
'image' => 'https://graph.facebook.com/me/picture?type=normal&access_token='.$token->access_token, …Run Code Online (Sandbox Code Playgroud) 我需要能够指定关系的条件(一对多).
例子是; 我们有一个帖子有很多评论,但我只想要用户A发表评论的帖子,然后返回帖子对象.
我目前可以想到这样做的唯一方法是使用Fluent查询,它不会返回我想要的Post对象!
编辑:
评论必须由用户A完成.发表评论的用户与帖子的关系不是直接关系.它将通过评论表.
RE编辑:
是否也可以说有不同的帖子?而不是返回3个相同的Post对象?
我使用分页到bootstrap 3应用程序,并有一些错误.这就是我称之为分页的方式:
$newsletterUsers = NewsletterUser::paginate(2);
Run Code Online (Sandbox Code Playgroud)
然后在foreach循环后我把它:
{{ $newsletterUsers->links() }}
Run Code Online (Sandbox Code Playgroud)
没关系?但不是显示正常漂亮的laravel分页,而是数字一个在另一个上,没有样式,甚至没有正确分页,因为它用1 - 1 - 2个元素分页,而不是2 - 2,因为它应该是
这是html标记:
<div class="pagination">
<ul>
<li><a href="---/public/newsletterConfirmedUser?page=2">«</a></li>
<li><a href="---/public/newsletterConfirmedUser?page=1">1</a></li>
<li><a href="---/public/newsletterConfirmedUser?page=2">2</a></li>
<li class="active"><span>3</span></li><li class="disabled">
<span>»</span></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
有人可以帮帮我吗?
再次学习者.
我只是想知道在控制器之间传递变量的最佳方法是什么?
在codeingniter中,我们曾经通过表单open命令将隐藏变量传回来,这在Laravel 4中是否可行?
最好只使用会话吗?
如何在不发送电子邮件的情况下测试此代码段?
public function forgot()
{
$isValid = $this->updateForm->valid(Input::only('email'));
if ($isValid) {
$result = $this->user->forgot($this->updateForm->data());
if (isset($result['user']) && ($result['success'] > 0)) {
Event::fire('user.mail.forgot', array('data'=>$result['user']));
return Response::json(array('success'=>1),200);
}
$error = isset($result['error'])?array_pop($result):trans('user.generror');
return Response::json(array(
'success'=>0,
'errors' => array('error'=>array($error))),
200);
}
return Response::json(array(
'success' => 0,
'errors' => $this->updateForm->errors()),
200
);
}
Run Code Online (Sandbox Code Playgroud)
到现在我测试它:
public function _getSuccess($content)
{
$json = str_replace(")]}',\n", '', $content);
$native = json_decode($json);
return $native->success;
}
public function _set200($method, $uri, $parameters = array())
{
$this->client->setServerParameter('HTTP_X-Requested-With', 'XMLHttpRequest');
$response = $this->call($method, $uri, $parameters);
$this->assertResponseStatus(200); …Run Code Online (Sandbox Code Playgroud) 我有一个域名,但我没有root访问权限.我只能访问/ home/bkhan06/public_html文件夹.您能告诉我如何在没有root访问权限的情况下部署应用程序.
laravel ×10
laravel-4 ×9
php ×6
eloquent ×2
facebook ×1
hybridauth ×1
oauth-2.0 ×1
pagination ×1
phpunit ×1
webserver ×1