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

View File

@@ -7,6 +7,4 @@ use Illuminate\Database\Eloquent\Model;
class Traffic extends Model
{
protected $fillable = ['user_id', 'upload', 'download'];
protected $primaryKey = null;
}

View File

@@ -260,7 +260,10 @@ class User extends Authenticatable
*/
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([
'user_id' => $this->id,
]);
@@ -269,7 +272,7 @@ class User extends Authenticatable
'upload' => $record->upload + $file_size
]);
}
/**
* Record user download filesize
*
@@ -277,7 +280,10 @@ class User extends Authenticatable
*/
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([
'user_id' => $this->id,
]);

View File

@@ -14,6 +14,7 @@ class CreateTrafficTable extends Migration
public function up()
{
Schema::create('traffic', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('user_id');
$table->bigInteger('upload')->default(0);
$table->bigInteger('download')->default(0);
@@ -28,6 +29,6 @@ class CreateTrafficTable extends Migration
*/
public function down()
{
Schema::dropIfExists('traffics');
Schema::dropIfExists('traffic');
}
}

View File

@@ -53,10 +53,8 @@ import {mapGetters} from 'vuex'
pointer-events: none;
padding: 10px;
border-radius: 8px;
box-shadow: 0 5px 10px -6px rgba(26, 36, 55, 0.15);
background:$light_background;
box-shadow: 0 7px 25px 1px rgba(0, 0, 0, 0.12);
background:white;
}
.wrapper {

View File

@@ -100,7 +100,7 @@ var vueFileManager = new Vue({
document.addEventListener('drag', (event) => {
let multiSelect = document.getElementById('multi-select-ui')
multiSelect.style.top = event.clientY +25 + 'px'
multiSelect.style.left = event.clientX - 50 + 'px'
multiSelect.style.top = event.clientY + 20 + 'px'
multiSelect.style.left = event.clientX + 'px'
},false)