server126

804 经验值

请问站长 “PhpStorm” 用的是什么主题样式?

我感觉您的挺好看的,能否分享一下?

laravel5.1版本

网站注册会员完毕后自动登录了,然后跳转到首页了(比如:/home)

但是当用户再次打开http://www.xxx.com/login或者 http://www.xxx.com/register页面时候我想让它自动判断是否登录,然后进行跳转页面设置
我写的代码没有生效,不知道为什么,代码如下:

//  Authenticate类里面的
public function handle($request, Closure $next)
        {
            if ($this->auth->check()) {
                return redirect('http://www.xxx.com/home');
            }
            return $next($request);
        }

问题已经解决,是win系统的问题(部署正式环境上就没有问题了),如果mac(开发环境)就可以,

按照楼主的视频(Laravel实现第三方登录)做了个demo,发现测试(集成Github)报错了、

Whoops, looks like something went wrong.

1/1
RequestException in CurlFactory.php line 187:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
in CurlFactory.php line 187
at CurlFactory::createRejection(object(EasyHandle), array('errno' => '60', 'error' => 'SSL certificate problem: unable to get local issuer certificate', 'url' => 'https://github.com/login/oauth/access_token', 'content_type' => null, 'http_code' => '0', 'header_size' => '0', 'request_size' => '0', 'filetime' => '-1', 'ssl_verify_result' => '0', 'redirect_count' => '0', 'total_time' => '4.891', 'namelookup_time' => '0.062', 'connect_time' => '4.516', 'pretransfer_time' => '0', 'size_upload' => '0', 'size_download' => '0', 'speed_download' => '0', 'speed_upload' => '0', 'download_content_length' => '-1', 'upload_content_length' => '-1', 'starttransfer_time' => '0', 'redirect_time' => '0', 'redirect_url' => '', 'primary_ip' => '192.30.253.113', 'certinfo' => array(), 'primary_port' => '443', 'local_ip' => '192.168.10.11', 'local_port' => '19349')) in CurlFactory.php line 150
at CurlFactory::finishError(object(CurlHandler), object(EasyHandle), object(CurlFactory)) in CurlFactory.php line 103
at CurlFactory::finish(object(CurlHandler), object(EasyHandle), object(CurlFactory)) in CurlHandler.php line 43
at CurlHandler->__invoke(object(Request), array('synchronous' => true, 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Proxy.php line 28
at Proxy::GuzzleHttp\Handler\{closure}(object(Request), array('synchronous' => true, 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Proxy.php line 51
at Proxy::GuzzleHttp\Handler\{closure}(object(Request), array('synchronous' => true, 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in PrepareBodyMiddleware.php line 72
at PrepareBodyMiddleware->__invoke(object(Request), array('synchronous' => true, 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Middleware.php line 30
at Middleware::GuzzleHttp\{closure}(object(Request), array('synchronous' => true, 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in RedirectMiddleware.php line 68
at RedirectMiddleware->__invoke(object(Request), array('synchronous' => true, 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Middleware.php line 59
at Middleware::GuzzleHttp\{closure}(object(Request), array('synchronous' => true, 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in HandlerStack.php line 67
at HandlerStack->__invoke(object(Request), array('synchronous' => true, 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Client.php line 275
//Article 中的Model
        public function tags()
        {
            return $this->belongsToMany(ArticleTag::class, 'article_tag', 'article_id', 'tag_id');
        }

我这个里面的ArticleTag 就等于您视频中的Tags 表

articles数据表 (id name)

article_tags数据表 (id name)

article_tag关联表 (article_id (外键与aritlces表中的id) tag_id(外键与article_tags表中的id))

我的写法跟您的是一样的,我只不过是指定外键等参数而已呀

好的,感谢已经修复样式了,那麻烦帮我看一下如何解决这个问题吗?谢谢了

请问一下,我按照楼主的视频(Laravel 多对多简析 )系列课程做测试发现一个问题,功能都是实现了,但是有一个问题,无法正确获取article_tag关联表中的name字段值

数据表结构如下:

#articles数据表  (id name)

#tags数据表      (id name)

#article_tag关联表    (article_id (外键与aritlces表中的id)  tag_id(外键与tags表中的id))


  public function tags()  //Article 模型中
        {
            return $this->belongsToMany(ArticleTag::class, 'article_tag', 'article_id', 'tag_id');
        }

然后自己tinker了几条测试数据,发现一个问题如下:

$a=Article::find(1);
$a->tags  //回车后值显示一列数组
>>> $a->tags
=> [
     1,
     2,
     3,
     4,
   ]
>>>

比如:我在form中提交数据的时候,如何不是假死页面,而且是出现一个loading小动画那种功能??