Laravel 我无法从postgresql检索数据
StudentController.phpLaravel 我无法从postgresql检索数据,laravel,postgresql,Laravel,Postgresql,StudentController.php SQLSTATE[42883]:未定义的函数:7错误:运算符不存在:字符变化=整数行1:…“oex\U考试母版”上的“oex\U类别”。“类别”=“oex\U cat…”提示:没有运算符与给定的名称和参数类型匹配。您可能需要添加显式类型转换。(SQL:选择“oex\U考试母版”。*,)oex_类别。“名称”作为“cat_名称”,来自“oex_考试大师”内部加入“oex_考试大师”上的“oex_类别”。“类别”=“oex_类别”。“id”其中“oex_考
SQLSTATE[42883]:未定义的函数:7错误:运算符不存在:字符变化=整数行1:…“oex\U考试母版”上的“oex\U类别”。“类别”=“oex\U cat…”提示:没有运算符与给定的名称和参数类型匹配。
您可能需要添加显式类型转换。(SQL:选择“oex\U考试母版”。*,)oex_类别。“名称”作为“cat_名称”,来自“oex_考试大师”内部加入“oex_考试大师”上的“oex_类别”。“类别”=“oex_类别”。“id”其中“oex_考试大师”。“状态”=1按“id”描述排序)
您的$resp=Oex_学生::where('email',$request->email)->where('password',$request->password)->get()->first();
不正确使用get()或first()而不是同时使用两者
<?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);
}
}
<?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');
}
}