亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

SQLSTATE[22P02]: 無效的文本表示形式: 7 錯誤: 無效的整數輸入語法

SQLSTATE[22P02]: 無效的文本表示形式: 7 錯誤: 無效的整數輸入語法

PHP
繁花不似錦 2022-09-12 11:11:17
我登錄到我的heroku應用程序,這是一個酒店評論應用程序:http://immense-beach-76879.herokuapp.com/。顯然,它不會顯示我在 http://immense-beach-76879.herokuapp.com/reviews 輸入的數據。它只是顯示錯誤。它說了一些關于整數是錯誤的選擇,因為“kiki”應該是一個字符串,對嗎?如果你需要看我的代碼,這里是:https://github.com/kikidesignnet/hotelreviews。這是我的錯誤:SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "kiki" (SQL: select * from "reviews" where "user_id" in (1, kiki, [email protected], ?, 2020-02-07 05:57:47, 2020-02-07 05:57:47) order by "created_at" desc limit 20)我一直在學習本教程,以了解拉拉維爾以及 React/Laravel 如何協同工作:https://kaloraat.com/articles/laravel-react-crud-tutorial 和他們的 github repo:https://github.com/kaloraat/laravel-react-crud這是我的遷移:create_reviews_table.php<?phpuse Illuminate\Database\Migrations\Migration;use Illuminate\Database\Schema\Blueprint;use Illuminate\Support\Facades\Schema;class CreateReviewsTable extends Migration{    /**     * Run the migrations.     *     * @return void     */    public function up()    {        Schema::create('reviews', function (Blueprint $table) {            $table->increments('id');            $table->integer('user_id')->unsigned()->index();            $table->string('name');            $table->timestamps();        });    }    /**     * Reverse the migrations.     *     * @return void     */    public function down()    {        Schema::dropIfExists('reviews');    }}如您所見,此應用程序應該注冊新用戶。然后,當用戶登錄并提交酒店評論時,reviews.api應該保存數據并在評論表單下方顯示評論。我所能看到的是表單正在工作,在下面提交數據,但它沒有顯示任何達達...
查看完整描述

1 回答

?
BIG陽

TA貢獻1859條經驗 獲得超6個贊

您可以在您的方法中更改此行(17)indexApp\Http\Controllers\ReviewController

$allReviews = $review->whereIn('user_id', $request->user())->with('user');

$allReviews = $review->where('user_id', $request->user()->id)->with('user');

$allReviews = $review->where('user_id', \Auth::id())->with('user');


查看完整回答
反對 回復 2022-09-12
  • 1 回答
  • 0 關注
  • 339 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號