我无法从Postgresql检索数据

时间:2020-10-22 10:02:29

标签: laravel postgresql

StudentController.php

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: character varying = integer LINE 1: ..."oex_categories" on "oex_exam_masters"."category" = "oex_cat... ^ HINT: No operator matches the given name and argument types.

You might need to add explicit type casts. (SQL: select "oex_exam_masters".*, "oex_categories"."name" as "cat_name" from "oex_exam_masters" inner join "oex_categories" on "oex_exam_masters"."category" = "oex_categories"."id" where "oex_exam_masters"."status" = 1 order by "id" desc)

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Oex_students;

class StudentController extends Controller
{
    public function signup()
    {
        return view('student.signup');
    }

    public function login_sub(Request $request)
    {
        $resp = Oex_students::where('email', $request->email)
            ->where('password',$request->password)
            ->get()
            ->first();
                    
        if ($resp) {
            $request->session()->put('id',$resp->id);

            $arr=array(
                'status' => 'true',
                'message' => 'success',
                'reload' => url('student/dashboard')
            );
        } else {
            $arr=array('status'=>'false','message'=>'Email And Password Not Match');    
        }
        echo json_encode($arr);
    }
}

student.php

这是我的迁移页面

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOexStudentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('oex_students', function (Blueprint $table) {
            $table->increments('id');   
            $table->string('name')->nullable();
            $table->string('email')->nullable();
            $table->string('mobile_no')->nullable();
            $table->string('category')->nullable();
            $table->string('exam')->nullable();
            $table->string('password')->nullable();
            $table->string('dob')->nullable();
            $table->string('status')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('oex_students');
    }
}

0 个答案:

没有答案