I want to validate the input if the client_id in inserting is existing from the other table
Table where client_id is selected if existing
Schema::create('cluster_members', function (Blueprint $table) {
$table->increments('id');
$table->integer('cluster_id')->unsigned()->nullable();
$table->integer('client_id')->unsigned()->nullable();
$table->softDeletes();
$table->timestamps();
});
Table where i will insert the record if passed the validation
Schema::create('loan_applications', function (Blueprint $table) {
$table->increments('id');
$table->integer('client_id')->unsigned()->index();
$table->integer('product_id')->unsigned()->index();
});
So in my Controller
Here is my rule
$rule = ['client_id'=>'required | numeric | exists:clients,id | exists:cluster_members,client_id'];
And this throws me this error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id ' in 'where clause'