samedi 27 août 2016

laravel 5 query builder restrict

well i am stuck in this scenario
there is 3 tables candidate table,position table and recruitment form table. Candidate-id and position-id is a foreign key in recruitment form table when candidate apply for a position which he already applied he can't apply for that post again i tried something like this but not working . If there some error please solve it or recommend some other method to achieve this thank you.

$check = DB::table('recruitmentform')->select('positionid')->where('candidateid',$cid)->get();

    for ($i = 0; $i < count($check); $i++) {
        if ($check[$i] == $pid) {
            return redirect('/');
        }
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire