traffic fix

drag preview styling
This commit is contained in:
Peter Papp
2020-11-29 09:39:26 +01:00
parent e86ea3e5c4
commit 1981f39f9e
5 changed files with 16 additions and 13 deletions
-2
View File
@@ -7,6 +7,4 @@ use Illuminate\Database\Eloquent\Model;
class Traffic extends Model class Traffic extends Model
{ {
protected $fillable = ['user_id', 'upload', 'download']; protected $fillable = ['user_id', 'upload', 'download'];
protected $primaryKey = null;
} }
+8 -2
View File
@@ -260,7 +260,10 @@ class User extends Authenticatable
*/ */
public function record_upload($file_size) public function record_upload($file_size)
{ {
$record = Traffic::whereMonth('created_at', '=', Carbon::now()->month) $now = Carbon::now();
$record = Traffic::whereYear('created_at', '=', $now->year)
->whereMonth('created_at', '=', $now->month)
->firstOrCreate([ ->firstOrCreate([
'user_id' => $this->id, 'user_id' => $this->id,
]); ]);
@@ -277,7 +280,10 @@ class User extends Authenticatable
*/ */
public function record_download($file_size) public function record_download($file_size)
{ {
$record = Traffic::whereMonth('created_at', '=', Carbon::now()->month) $now = Carbon::now();
$record = Traffic::whereYear('created_at', '=', $now->year)
->whereMonth('created_at', '=', $now->month)
->firstOrCreate([ ->firstOrCreate([
'user_id' => $this->id, 'user_id' => $this->id,
]); ]);
@@ -14,6 +14,7 @@ class CreateTrafficTable extends Migration
public function up() public function up()
{ {
Schema::create('traffic', function (Blueprint $table) { Schema::create('traffic', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('user_id'); $table->bigInteger('user_id');
$table->bigInteger('upload')->default(0); $table->bigInteger('upload')->default(0);
$table->bigInteger('download')->default(0); $table->bigInteger('download')->default(0);
@@ -28,6 +29,6 @@ class CreateTrafficTable extends Migration
*/ */
public function down() public function down()
{ {
Schema::dropIfExists('traffics'); Schema::dropIfExists('traffic');
} }
} }
@@ -53,10 +53,8 @@ import {mapGetters} from 'vuex'
pointer-events: none; pointer-events: none;
padding: 10px; padding: 10px;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 5px 10px -6px rgba(26, 36, 55, 0.15); box-shadow: 0 7px 25px 1px rgba(0, 0, 0, 0.12);
background:$light_background; background:white;
} }
.wrapper { .wrapper {
+2 -2
View File
@@ -100,7 +100,7 @@ var vueFileManager = new Vue({
document.addEventListener('drag', (event) => { document.addEventListener('drag', (event) => {
let multiSelect = document.getElementById('multi-select-ui') let multiSelect = document.getElementById('multi-select-ui')
multiSelect.style.top = event.clientY +25 + 'px' multiSelect.style.top = event.clientY + 20 + 'px'
multiSelect.style.left = event.clientX - 50 + 'px' multiSelect.style.left = event.clientX + 'px'
},false) },false)