Guest User

Untitled

a guest
Dec 10th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. $vote = Vote::updateOrCreate(
  2. ['thread_id' => $id, 'user_id' => Auth::id()],
  3. ['type' => $request->type]
  4. );
  5.  
  6. Schema::create('votes', function (Blueprint $table) {
  7. $table->increments('id');
  8. $table->integer('user_id')->unsigned();
  9. $table->integer('thread_id')->unsigned();
  10. $table->boolean('type');
  11. $table->timestamps();
  12.  
  13. $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
  14. $table->foreign('thread_id')->references('id')->on('threads')->onDelete('cascade');
  15. });
Add Comment
Please, Sign In to add comment