小编Vir*_*ani的帖子

只有用户模型使用空值保存到数据库

在Laravel 5.4中,当我尝试将用户模型保存到数据库时,不保存值.我也设置了可填充属性.

它在Laravel 5.3中工作.将应用程序升级到Laravel 5.4之后,就会出现此问题.

以下是用户模型.

class User extends BaseModel implements AuthenticatableContract, CanResetPasswordContract, JWTSubject
{
    use SoftDeletes,
        UserAccess,
        UserAttribute,
        UserRelationship,
        Authenticatable,
        CanResetPassword,
        Notifiable;

    /**
     * Database Table
     *
     * @var string
     */
    protected $table = "users";

    /**
     * The attributes that are not mass assignable.
     *
     * @var array
     */
    protected $guarded = ['id'];

    /**
     * Fillable Form Fields
     *
     * @var array
     */
    protected $fillable = [
        'name',
        'first_name',
        'last_name',
        'email',
        'password',
        'status',
        'confirmed',
        'api_user',
        'confirmation_code',
        'account_id',
        'role_id',
        'cw_contact_id', …
Run Code Online (Sandbox Code Playgroud)

php laravel eloquent laravel-5.4

11
推荐指数
3
解决办法
451
查看次数

如何为服务器端刷新facebook访问令牌(在facebook-php SDK中)?

我正在使用Facebook PHP SDK来调用相关的API来发布和获取数据.目前我正在数据库中保存用户访问令牌,但它会在60天后过期.如何刷新用户访问令牌?

1.我什么时候需要刷新访问令牌?它到期后还是之前?

2.刷新访问令牌的最佳方法是什么?

3.我的用户是否需要再次登录才能刷新访问令牌?

这是我用来扩展访问令牌的功能.但到期时间保持不变.

public function getExtendedAccessToken($access_token)
    {       

        $token_url="https://graph.facebook.com/oauth/access_token";
        $params=array('client_id'=>self :: appId,'client_secret'=>self :: appSecretId,'grant_type'=>'fb_exchange_token','fb_exchange_token'=>$access_token);

          $response = $this->curl($token_url,$params);                  
          $response = explode ('=',$response);
          $response = explode ('&',$response[1]);
          $response = $response[0];       
          return $response;

    }
Run Code Online (Sandbox Code Playgroud)

php facebook facebook-graph-api facebook-php-sdk facebook-access-token

8
推荐指数
1
解决办法
9778
查看次数

为什么linkedin连接rest API会给出错误的成员ID?

我在php中的应用程序,我将从这个其他API获取我的网络的所有连接.

http://api.linkedin.com/v1/people/~/connections?modified=new

但它给出了错误的会员ID.我在LinkedIn休息控制台(https://developer.linkedin.com/rest-console)中检查了相同的API结果,但它提供了不同的输出.

控制台输出:

<person>
    <id>nzdqEWJjKM</id>
    <first-name>Sagar</first-name>
    <last-name>Modi</last-name>
    <headline>Sr. HR Officer - Generalist at MAS Financial Services Ltd.</headline>
    <picture-url>http://m3.licdn.com/mpr/mprx/0_3vxs_YPyEsnVrHXzT-Jd_pvlox-zraqzitwL_pt_zJ6LfEivSP7nDy6SXttoPdzJhngkuU2v-HG2</picture-url>
    <api-standard-profile-request>
      <url>http://api.linkedin.com/v1/people/nzdqEWJjKM</url>
      <headers total="1">
        <http-header>
          <name>x-li-auth-token</name>
          <value>name:PSbh</value>
        </http-header>
      </headers>
    </api-standard-profile-request>
    <site-standard-profile-request>
      <url>http://www.linkedin.com/profile/view?id=54732271&authType=name&authToken=PSbh&trk=api*a108281*s116823*</url>
    </site-standard-profile-request>
    <location>
      <name>Ahmedabad Area, India</name>
      <country>
        <code>in</code>
      </country>
    </location>
    <industry>Human Resources</industry>
  </person>
Run Code Online (Sandbox Code Playgroud)

使用我的应用程序中的rest API输出:

<person>
    <id>7dmJjxBx_k</id>
    <first-name>Sagar</first-name>
    <last-name>Modi</last-name>
    <headline>Sr. HR Officer - Generalist at MAS Financial Services Ltd.</headline>
    <picture-url>http://m3.licdn.com/mpr/mprx/0_3vxs_YPyEsnVrHXzT-Jd_pvlox-zraqzitwL_pt_zJ6LfEivSP7nDy6SXttoPdzJhngkuU2v-HG2</picture-url>
    <api-standard-profile-request>
      <url>http://api.linkedin.com/v1/people/7dmJjxBx_k</url>
      <headers total="1">
        <http-header>
          <name>x-li-auth-token</name>
          <value>name:PSbh</value>
        </http-header>
      </headers>
    </api-standard-profile-request>
    <site-standard-profile-request>
      <url>http://www.linkedin.com/profile/view?id=54732271&amp;authType=name&amp;authToken=PSbh&amp;trk=api*a184885*s193024*</url>
    </site-standard-profile-request>
    <location>
      <name>Ahmedabad Area, India</name>
      <country> …
Run Code Online (Sandbox Code Playgroud)

linkedin

5
推荐指数
1
解决办法
1983
查看次数

通过.htaccess强制特定页面上的非SSL(http)和所有其他页面上的SSL

我正在使用Zend-Framework,下面是我的htaccess的代码.

rewriteEngine On

RewriteCond %{HTTPS} =off
RewriteRule ^(.*)$ https://www.mysite.co/$1 [R=301,L] 
RewriteCond %{http_host} ^mysite.co [NC]
RewriteRule ^(.*)$ https://www.mysite.co/$1 [R=301,L] 

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Run Code Online (Sandbox Code Playgroud)

现在我想在所有其他页面上强制使用mysite.co/news/*和https上的http.那么我该如何申请规则呢?

ssl https zend-framework http

5
推荐指数
1
解决办法
203
查看次数

获取当前路径 Laravel 5

我试图找到当前路线的完整路径 Laravel 5.x

对于这种情况,我使用以下代码创建了一个方法,但我无法想象它Laravel本身不提供这样的东西:

 $current = Route::getFacadeRoot()->current();
 $uri = $current->uri();
 foreach ($current->parameters() as $key => $param) {
     $uri = str_replace('{' . $key . '}', $param, $uri);
 }
 return url($uri);
Run Code Online (Sandbox Code Playgroud)

有什么开箱即用的东西Laravel我找不到吗?

php routes laravel laravel-5

5
推荐指数
2
解决办法
2万
查看次数

jQuery mobile - 仅在侧面板关闭时才允许滚动?

当任何侧栏打开时,我不希望用户滚动.它们应该在关闭时滚动.

我使用下面的代码,但它不适用于Android移动设备

$(document).bind('panelopen', function (e, data) {     
        $('body').css("overflow", "hidden");
    });

    $(document).bind('panelclose', function (e, data) {         
        $('body').css("overflow", "auto");
    });
Run Code Online (Sandbox Code Playgroud)

android jquery-mobile jquery-mobile-panel

2
推荐指数
1
解决办法
4981
查看次数