Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $vote = Vote::updateOrCreate(
- ['thread_id' => $id, 'user_id' => Auth::id()],
- ['type' => $request->type]
- );
- Schema::create('votes', function (Blueprint $table) {
- $table->increments('id');
- $table->integer('user_id')->unsigned();
- $table->integer('thread_id')->unsigned();
- $table->boolean('type');
- $table->timestamps();
- $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
- $table->foreign('thread_id')->references('id')->on('threads')->onDelete('cascade');
- });
Add Comment
Please, Sign In to add comment