Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 30019

submit data with the same email in database

$
0
0

How i just want to ask if how can i be able to store another data if i have the same email. i've been making a renting system. after a costumer returned the items, he can be able to send request to rent again. but when i try to submit another form request again. it shows

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'annecurtis@gmail.com' for key 'borrower_requests_email_unique. i already removed the unique() in my the email column on my borrowersRequest table.

how can i do that?

well here is in my controller where costumer submit the data.

 public function store(Request $request)
{
    $rentform = new BorrowerRequest;

    $rentform->user_id = $request->user_id;
    $rentform->car_id = $request->car_id;
    $rentform->borrowers_name = $request->borrowers_name;
    $rentform->email = $request->email;
    $rentform->return_date = $request->return_date;
    $rentform->contact_number = $request->contact_number;
    $rentform->request_status_id = $request->request_status_id;


    $rentform->save();

    $request->session()->flash('message', 'Your Request has been successfully submitted, please wait for a couple of hours for the approval');

    return redirect('/borrowershistory');

anyone pls? thank you. by the way im using laravel and phpmyadmin here.

 public function up()
{
    Schema::create('borrower_requests', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->unsignedBigInteger('user_id');
        $table->unsignedBigInteger('car_id');
        $table->timestamps();
        $table->string('borrowers_name', 50);
        $table->string('email');
        $table->bigInteger('contact_number');
        $table->date('return_date');
        $table->unsignedBigInteger('request_status_id')->default(0);
        $table->foreign('user_id')->references('id')->on('users');
        $table->foreign('car_id')->references('id')->on('cars');
        $table->foreign('request_status_id')->references('id')->on('request_statuses');

    });
}

Viewing all articles
Browse latest Browse all 30019

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>