Laravel Forms 使用
打赏作者

sonics34

为什么create的时候可以直接all(),而update的时候必须except(’_token’)呢

JellyBool

你使用all()的时候报什么错误? @sonics34

sonics34

@JellyBool

QueryException in Connection.php line 636:
SQLSTATE[42S22]: Column not found: 1054 Unknown column '_token' in 'field list' (SQL: update `articles` set `_token` = Hj8jEsbIikLfNHbVeZZSu0Df10mrCbIC5YUJAKdm, `title` = 22, `content` = 22d, `updated_at` = 2015-10-03 17:33:58 where `id` = 3)
JellyBool

你是使用了hidden表单,然后Article::find(),的吧这个时候是需要except('_token'),如果你想直接使用all(),那么,你可以将整个Article $article传入控制器的update()方法,在执行

$article->update();

@sonics34 顺便看看怎么使用markdown吧,这样排版好看很多,对双方都有好处

sonics34
 public function update(Request $request, $id)
{
    $input = $request -> except('_token');
	Article::where('id',$id) -> update($input);
	return redirect('articles/'.$id);
}     

如果这里的except改成all()就会报错,你说的整个传入是什么意思,没搞懂啊

JellyBool
public function update(Request $request, Article $article) {

		$article->update($request->all());

		return redirect('articles');

	}

这样试试,如果你的Form是使用Form::model()的话 @sonics34

mailman

如果我用原生的Html写表单的话,提交地址应该怎么写。

JellyBool

就直接写在action这里就可以:

<form action="/article/update"></form>

@mailman

mailman

如果用url('ariticl/update')

JellyBool

这个我没试过,你试一下呗 @mailman

mailman

@JellyBool 建一个网站或者教程的QQ群吧!!

JellyBool

这个很有必要么 ? @mailman

mailman

应该是有非常有用的,上班族,开QQ是允许的。在QQ上也可以交流,同时你搜一下laravel的QQ群,基本上没有。

JellyBool

好的,我现在去创建一个 @mailman

sonics34

@JellyBool 在使用 ->all()或者->get()获取用户提交数据的时候,会不会有sql注入的风险,还是laravel会自动过滤

bobby

@JellyBool 请问你的phpstorm的整套配置能否写个文档出来说明一下呢?感觉你的phpstrom配置很牛逼的样子。

JellyBool

请不用担心sql注入,这个laravel会帮你处理 @sonics34

JellyBool

想做的事情很多 ,关于phpstorm,想录一个系列的视频的 @bobby

Forging2012

亲,VPN用的是哪里的哈?被墙好恼火,慢的很。。。

Forging2012

站长在用阿里云 现在有个活动不错,可以参加哈
http://bbs.aliyun.com/read/256707.html?pos=1

JellyBool

VPN我用的是GreenVPN,这个活动我看过,并没有符号我的服务器邀请 @Forging2012

charlie

Composer 可以添加国内镜像 http://pkg.phpcomposer.com

JellyBool

恩恩,但是我一般不会干这种事 @charlie

charlie

哇哦~~Jelly后续还会出后续系列教程吗~感觉非常好啊~在zhihu上看到有人推荐您的教材,所以来了!

JellyBool

纳尼。。。哪个推荐的呀,给个推荐地址我看看。后面还有系列教程,会一直录 @charlie

charlie

@JellyBool http://www.zhihu.com/question/35149596
5、一个国内小伙做的laravel视频网站 Laravel Artist For Web Development

感谢出了这么棒的视频!

JellyBool

哈哈哈,感谢感谢 @charlie

caasi

@JellyBool 使用 post方法,报405错误。
MethodNotAllowedHttpException in RouteCollection.php line 219:

HappytreeFriends

感谢楼主!

shaoslu

楼主你好,怎么我添加文章的时候会提示下面错误

proud2008

farea tab之后生成的 没视频上讲的那么多代码 phpstorm9

JellyBool

可以看看phpstorm那个系列,设置live template @proud2008

_xurong

MassAssignmentException in Model.php line 424: _token 这是什么错误啊,一加Article::create($input);这句就报错

C_H_LK

@JellyBool
楼主好,为何我在存入post过来的字段到数据库中时,没有存入title字段。
在Article的Model已经定义了 protected $fillable = ['content','title','published_at'];
dd(Article::create($input)) 的结果为:

#attributes: array:5 [▼
    "content" => "32"
    "published_at" => Carbon {#147 ▶}
    "updated_at" => "2015-12-04 10:27:15"
    "created_at" => "2015-12-04 10:27:15"
    "id" => 7
  ]

想请教下这个是什么情况。Happy Hacking.

wildess

@caasi 因为你没有在路由里定义post

larry

illuminate/html在5.2有bug,用不了了

第九个张镇

我在下载过程中开了GreenVPN,但总是下载失败,问题在哪里呢??

Loading composer repositories with package information
Updating dependencies (including require-dev)
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
  - Installing illuminate/html (v5.0.0)
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Failed to download illuminate/html from dist: The "https://api.github.com/repos/illuminate/html/zipball/3d1009bb8e0f25720c914af5c1f4015dd373c9ef" file could not be downloaded: SSL: Handshake timed out
Failed to enable crypto
failed to open stream: operation failed
    Now trying to download from source
  - Installing illuminate/html (v5.0.0)
    Cloning 3d1009bb8e0f25720c914af5c1f4015dd373c9ef


  [RuntimeException]
  Failed to clone git@github.com:illuminate/html.git, git was not found, check that it is installed and in your PATH

env.
‘git’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...

JellyBool

安装git 试试呗 @第九个张镇

第九个张镇

@JellyBool 好吧,并没有什么用

thinkings

@JellyBool 本节视频中composer装的illuminate/html,如果程序都写好后,上传到主机上,是不是还需要在主机上重新composer这个包,还是已经存在于程序文件夹里啦?

thinkings

@第九个张镇 http://www.phpcomposer.com 用这里的镜像

thinkings

@C_H_LK dd(Article::create($input)) 这里返回的内容里就没有TITLE?

LiucaiHp
FatalErrorException in HtmlServiceProvider.php line 36:
Call to undefined method Illuminate\Foundation\Application::bindShared()

求解释怎么回事

JellyBool

你用的5.2版本的laravel吧,这个Form已经不再支持5.2以后的laravel了 ,用这个 @LiucaiHp

https://packagist.org/packages/laravelcollective/html

LiucaiHp

解决了,谢谢楼主
@JellyBool

LiucaiHp
{!! Form::text('name',null,['class'=>'form-control']) !!}

表单样式没有改变是为什么

JellyBool

你用了bootstrap没有 @LiucaiHp

LiucaiHp

哦,明白了,谢谢
@JellyBool

LiucaiHp
{!! Form::submit('发表文章',['class'=>'btn btn-primary form-control']) !!}

在页面怎么不显示文字但是输入英文就能显示,而且表单占据整个页面,撑的不好看,求解?

JellyBool

那就用英文呗,这是你的字符集问题,跟框架没啥关系 @LiucaiHp

LiucaiHp

恩恩,好了,今天重设了下字符集,可以显示了,可是我的样式还是表单撑满屏,显得不是很好看,不知道是什么原因。当然还要顶一下楼主,视频做的确实不错,人也很好,有什么问题都能及时给解决,这里在说一声谢谢!!我会一直坚持看完视频,努力学好laravel框架,也会把楼主的视频都推荐给我的同学们。

第九个张镇

@thinkings 谢谢,问题已解决

thinkings

@JellyBool https://packagist.org/packages/laravelcollective/html
用这个的话,是不是使用方法就跟视频里的不一样了?

JellyBool

差不多 @thinkings

thinkings
thinkings at thinkings in ~/LaravelStudy
$ composer require laravelcollective/html
Using version ^5.2 for laravelcollective/html
./composer.json has been updated
> php artisan clear-compiled


  [Symfony\Component\Debug\Exception\FatalErrorException]
  Class 'Collective\Html\HtmlServiceProvider' not found


Script php artisan clear-compiled handling the pre-update-cmd event returned with an error



  [RuntimeException]
  Error Output:

出错了,,,整不好,重建项目。。。。。

thinkings

新建 一个LARAVEL项目后,laravelcollective/html就安装成功了

thinkings at thinkings in ~/jjcs
$ composer require laravelcollective/html
Using version ^5.2 for laravelcollective/html
./composer.json has been updated
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing laravelcollective/html (v5.2.3)
    Downloading: 100%

Writing lock file
Generating autoload files
> php artisan optimize
Generating optimized class loader
thinkings
MassAssignmentException in Model.php line 448:
_token

提交表单后,写入数据库报这个错误?
@JellyBool

thinkings

晓得了,没有fillable

JellyBool

OK,问题解决了就好 @thinkings

thinkings

@JellyBool 这套视频真不错,还有几张就学完了,学到表单验证了。学完后,加入付费,值得。

JellyBool

嗯,到时候看你的需要呗。哈哈哈,付费支持一下我是很欢迎的 @thinkings

这一刻的曙光

Whoops, looks like something went wrong.

1/1
FatalErrorException in HtmlServiceProvider.php line 36:
Call to undefined method Illuminate\Foundation\Application::bindShared()
在From使用中就是刷不出来表单

JellyBool

你看看上面的评论吧 @这一刻的曙光

这一刻的曙光

5.1不支持吗??

这一刻的曙光

还是失败!

这一刻的曙光

换了个项目,还不行,让我欲哭无泪啊

这一刻的曙光

好吧,换了三个终于成功了

sean90

@JellyBool 我laravel 5.2的 composer require illuminate/html 用不成

JellyBool 回复 sean90

你看看评论。。上面就有说用:laravelcollective/html

ritaswc

楼主应该是广西那边的人吧

JellyBool 回复 ritaswc

恩,是的。从小一直都是说的白话,所以普通话就。。。。

Cense

老师 你的样式是不是bootstrap
在app.blade.php中引用吗?

JellyBool 回复 Cense

没记错的话,是的。

liudong0763

老湿,你系边度人啊

JellyBool 回复 liudong0763

广西梧州人士

墨生人

大神,我创建了2个控制器一个是TestController,一个是TestUpdateController,都继承Controller,使用的是同一个Test Model,但是TestController里面的方法配置路由都能正常访问,但是TestUpdateController里面的方法都会报这个错
Target [App\Http\Controllers\Test\TestUpdateController] is not instantiable,不知道是什么原因,网上找不到答案

JellyBool 回复 墨生人

TestUpdateController 这个代码可以给看看么?

墨生人 回复 JellyBool

现在好了,我删掉重新复制了一遍,就好了,不知道什么情况,可能是缓存

<?php
/**
 * Created by PhpStorm.
 * User: zhoujie
 * Date: 16/10/30
 * Time: 下午11:03
 */
namespace App\Http\Controllers\Test;

use App\Http\Controllers\BaseController;
use App\Models\Test;

class TestUpdateController extends BaseController
{
    public function __construct()
    {
        parent::__construct();
    }

    public function create()
    {
        $param = $this->validate_process();
        $id = Test::insertGetId($param);
        reset($param); $param['id'] = $id;
        return $id ? response()->json($param) : $this->errorOutput('CREATE_FAILD');
    }

    public function update()
    {
        $this->validation(['id' => 'required|numeric'], ['id' => '测试id']);
        $param = $this->validate_process();
        $id = intval($this->input['id']);
        $res = Test::where('id', $id)->update($param);
        return $res ? response()->json(['success' => 1]) : $this->errorOutput('UPDATE_FAILD');
    }

    public function delete()
    {
        $this->validation(['id' => 'required|numeric'], ['id' => '测试id']);
        $id = intval($this->input['id']);
        $res = Test::destroy($id);
        return $res ? response()->json(['success' => 1]) : $this->errorOutput('DELETE_FAILD');
    }

    private function validate_process()
    {
        $rules = [
            'name'     => 'required|unique:mysql-i.users|alpha_dash|max:32',
            'password' => 'required|alpha_dash|min:6|max:32',
            'tel'      => 'required|digits_between:3, 18',
            'email'    => 'required|email|min:3|max:32',
            'avatar'   => 'min:3'
        ];
        $attr = [
            'name'     => '用户名',
            'password' => '用户密码',
            'tel'      => '用户电话',
            'email'    => '用户邮箱',
            'avatar'   => '用户头像',
        ];
        if (!empty($this->input['id'])) { $rules['name'] = 'required|alpha_dash|max:32'; }
        $this->validation($rules, $attr);
        return [
            'name'     => trim($this->input['name']),
            'password' => trim($this->input['password']),
            'tel'      => trim($this->input['tel']),
            'email'    => trim($this->input['email']),
            'avatar'   => $this->input['avatar'] ? serialize($this->input['avatar']) : '',
            'create_time' => TIMENOW
        ];
    }
}
JellyBool 回复 墨生人

行,问题解决了就 OK。。。

zy812415556

5.3的laravelcollective/html也不能用,只能手写html表单了吗?

JellyBool 回复 zy812415556

额。。。没记错的话,5.3 还是可以使用 laravelcollective/html 的吧

yiyufxst 回复 JellyBool

楼主,看视频的时候有很多小点感觉想记录一下,免得以后忘了,也就是说可以在看完视频后自己整理一些东西发博客么?发的时候备注一下来自楼主的视频后期整理?

yiyufxst 回复 zy812415556

composer的时候把illuminate/html在config/app.php的配置删掉就可以安装成功
配置laravelcollective/html看这个网站https://laravelcollective.com/docs/5.3/html#installation

LiuChao321

老湿啊,我在laravel目录下命令行composer require illuminata/html,生成的不是在vendor/laravel/framework/src/illuminate/html下面,而是在vendor下新建一个文件夹illuminate/html,导致后续无法跟您继续学习下去了

harverychina

感谢老师的认真录制,我已经学到了不少东西,@JellyBool,Think you!

ForeverPdq

您好,{!! Form::text(‘test’,null,[‘class’=>‘form-control’]) !!}这里第二个nul代表默认数据为空 这个是什么意思 没明白

JellyBool 回复 ForeverPdq

value 为空

ForeverPdq

还有为什么我输入farea 按tab 不会弹出来一堆东西,是不是还得装什么东西呢,大神

rpjltx

我在执行 composer require illuminate/html 时 提示 “Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.”

JellyBool 回复 rpjltx

5.2 之后用这个,https://laravelcollective.com/docs/5.3/html#installation

你看看评论就知道了

rpjltx 回复 JellyBool

执行第一条命令 composer require “laravelcollective/html”:"^5.3.0" 报错 “Your requirements could not be resolved to an installable set of packages.
Installation failed, reverting ./composer.json to its original content.”

JellyBool 回复 rpjltx

你的环境没满足最低的要求吧

rpjltx 回复 JellyBool

已经解决了,我的应该使用 5.2.0,谢谢。

824286145

Sorry, the page you are looking for could not be found.
2/2 NotFoundHttpException in Handler.php line 103: No query results for model [App\Article].

JellyBool 回复 824286145

贴报错信息之前先稍微看一下评论吧,何况你这样我也不知道是什么地方的代码出错了

JellyBool 回复 824286145

贴报错信息和代码的时候,稍微注意一下格式吧。格式排版看这里 https://www.laravist.com/discuss/markdown/learn-to-use-markdown-21

你的问题视频中就有讲到 4:40 左右看看。看视频还是稍微认真一点吧,贴报错信息前稍微看一下评论。

zhl6522 回复 824286145

可能的原因:
1、你的粗心,路由里面写错了;
2、路由里面位置错误;

824286145

composer require illuminate/html 照 着视频 装完后,新建了个路由,就报上面的错误了 public function create()
{
return 123;
// return view(‘articles.create’);
}

JellyBool 回复 824286145

贴报错信息和代码的时候,稍微注意一下格式吧。格式排版看这里 https://www.laravist.com/discuss/markdown/learn-to-use-markdown-21

你的问题视频中就有讲到 4:40 左右看看。看视频还是稍微认真一点吧,贴报错信息前稍微看一下评论。

824286145

Route::any(’/articles/create’,function(){
echo 888;
});

JellyBool 回复 824286145

贴报错信息和代码的时候,稍微注意一下格式吧。格式排版看这里 https://www.laravist.com/discuss/markdown/learn-to-use-markdown-21

你的问题视频中就有讲到 4:40 左右看看。看视频还是稍微认真一点吧,贴报错信息前稍微看一下评论。

824286145

Route::get(’/articles/{id}’,‘ArticlesController@show’);
Route::get(’/articles/create’,‘ArticlesController@create’); 昭着你视频写的,这条路由就会报错
Route::get(’/article/create’,‘ArticlesController@create’);

JellyBool 回复 824286145

贴报错信息和代码的时候,稍微注意一下格式吧。格式排版看这里 https://www.laravist.com/discuss/markdown/learn-to-use-markdown-21

你的问题视频中就有讲到 4:40 左右看看。看视频还是稍微认真一点吧,贴报错信息前稍微看一下评论。

laravpan

illuminate/html 是不是 被放弃了 改成 laravelcollective / HTML

JellyBool 回复 laravpan

恩,是的。 5.2 之后用后者

laravpan

老师 为什么 我的Canbon phpstorm 不会自动引入类

JellyBool 回复 laravpan

你设置一下 auto import,command shift a 搜 auto import

LWJ

楼主我照着弄都弄出来了,但框框的大小不像你那样全屏宽。我照着弄好窄。

野生奥特曼打小怪兽
Using version ^5.0 for illuminate/html
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing illuminate/html (v5.0.0): Downloading (100%)
Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader

D:\wamp64\www\laravel5.2\blog>composer require laravelcollective/html
Using version ^5.4 for laravelcollective/html
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework v5.2.45
    - Conclusion: don't install laravel/framework v5.2.45
    - laravelcollective/html v5.4 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.9].
    - laravelcollective/html v5.4.1 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.9].
    - don't install illuminate/view v5.4.0|don't install laravel/framework v5.2.45
    - don't install illuminate/view v5.4.13|don't install laravel/framework v5.2.45
    - don't install illuminate/view v5.4.17|don't install laravel/framework v5.2.45
    - don't install illuminate/view v5.4.9|don't install laravel/framework v5.2.45
    - Installation request for laravel/framework (locked at v5.2.45, required as 5.2.*) -> satisfiable by laravel/framework[v5.2.45].
    - Installation request for laravelcollective/html ^5.4 -> satisfiable by laravelcollective/html[v5.4, v5.4.1].


Installation failed, reverting ./composer.json to its original content.```


大神,我html表单插件的时候怎么不行?illuminate/html说已经弃用,让我用laravelcollective/html 但是require就报错。咋回事呢?我laravel是5.2.45版本。
玩世顽童

LZ,app.php裏面provider和alias的包路徑你是怎麽知道的?比如Collective\Html\HtmlServiceProvider::class,有什麽規律嗎

JellyBool 回复 玩世顽童

多看文档,或者看源码的命名空间

octopus

happy hacking 是啥意思?

JellyBool 回复 octopus

啊哈,来源于 HHKB 这个键盘。

大概就是:快乐编码。希望写代码的时候比较开心

高永立

单纯的测试Markdown语法

$article->update();
a359611223

同步修改是使用了什么plugins还是快捷键?

dppppp

image.png

老师请问一下 我用Form::text这个方法在视图里面可以用,在控制器里面用不了吗?

JellyBool 回复 dppppp

阔以的,use Form;

dppppp 回复 JellyBool

还真行,谢谢老师。顺便问下您,phpstorm怎么不会自动导入这个 use Form;呢? 还有就是模板里面怎么没导入就可以用了呢
Illuminate\Html\HtmlServiceProvider::class,
'Form' => Illuminate\Html\FormFacade::class,
在 providers 和 aliases里面写的东西为什么不一样呢?

JellyBool 回复 dppppp

你先看 PHP OOP 系列,再看深入 laravel 系列就OK

dppppp 回复 JellyBool

好的,老师,是准备订阅来着,也是决定从第一个视频开始往后看,感觉还是要有的东西很难理解很难记,老师说的这个思路正是我想问的,就是看你视频的先后顺序,能更细点跟我说明一下吗?

stevedjyz

请问老师你的教程在哪里,我想看看文字版

JellyBool 回复 stevedjyz

就在导航的文章那里

stevedjyz 回复 JellyBool

好的 谢谢老师

noikiy

illuminate/html 被抛弃了,use laravelcollective/html .

JellyBool 回复 noikiy

嗯哼,这种评论质量就很高

noikiy

就是这个fell 倍儿爽!!嘿嘿

eric2100

請教老師在5.4版本如何做到 ajax 回應 message
這套件只支援5.1
https://packagist.org/packages/lrgt/laravel-form-ajax-validation

JellyBool 回复 eric2100
axios.post('/payment/check', {
                    chargeId: chargeId
                }).catch(error => {
                  // 在这里
                }).then(response => {
                    if (response.data.finished) {
                        this.status = 'success';
                    }
                })

使用 axios 的话,就是 catch 那里写呗

wh9281

Route::get(’/articles/{id}’,‘ArticlesController@show’);
Route::get(’/articles/create’,‘ArticlesController@create’);
如果这个 create放到{id}下面。http://localhost:8000/articles/create 这样访问会进入show方法。放到{id}前面并不会。
这是什么原因引起的呢,并不想把这2个路由的顺序切换

JellyBool 回复 wh9281

因为路由的匹配是从上到下的,如果 create 放到 {id} 下面,create 就认为是 /articles/{id} 的 id 的参数了。

wh9281 回复 JellyBool

恩。我是这样认为的,但是我看你并没有写在{id}上,为啥可以执行

wh9281 回复 JellyBool

不好意思。是我的问题。本来我都猜到估计你后面可能应该有解决的,但是、强迫症。。让我先暂停了

wh9281 回复 JellyBool

我还以为你就是把create写到{id}之后的,所有才钻了牛角尖

tkin1992
   ErrorException in Macroable.php line 81:
Method lable does not exist. (View: /home/yusheng/PhpstormProjects/Laravel-learn/Laravel5.1/resources/views/articles/create.blade.php)
tkin1992

老师,我用的是5.1的laravel啊,然后用的是illuminate/html.如果只写了open和close是可以的,但加了其他就不行了

JellyBool 回复 tkin1992

注意你的方法名字写对了没

tkin1992 回复 JellyBool

谢谢老师,我弄好了

sandilion

jelly我一直报一个错误就是:
FatalErrorException in ProviderRepository.php line 146:
Class ‘Illuminate\Html\HtmlServiceProvider’ not found

myoppo 回复 sandilion

这是因为你没有在配置文件config总的app.php中添加
Illuminate\Html\HtmlServiceProvider::class,
‘Form’ => Illuminate\Html\FormFacade::class,
要填对地方,要确保你的illuminate安装成功,你可以在vendor下看有无这个文件夹:illuminate

ningzhenzhen123

执行composer require illuminate/html就好像报错了似得,如下信息:
Using version ^5.0 for illuminate/html
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals

  • Installing illuminate/html (v5.0.0):
    Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.
    Writing lock file
    Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover

[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Illuminate\Foundation\Application::bindShared()

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

然后访问页面就报错:
Call to undefined method Illuminate\Foundation\Application::bindShared() (View: D:\phpStudy\WWW\test\jstylelaravel\resources\views\articles\create.blade.php)

zzz1575

提交两个自己遇到的问题
Route ::get(’/articles/{id}’,‘ArticlesController@show’); 第一个注册路由的时候不能有空格
第二$input[‘publicshed_at’]=Carbon::now();
不够细心按照自己思维走了 public 是发表的意思自己按照public的意思写入不够仔细,找错找了半天思路不对,看到_token还以为是前端代码问题还在比对name的值

zzz1575

如果出现_token的问题 请在mode里添加上白名单
protected $fillable = [‘title’, ‘content’,‘published_at’];

ddwzdd

只需要改 composer require laravelcollective/html 吧?