diff --git a/app/Traffic.php b/app/Traffic.php index 1fa45553..5c8dd833 100644 --- a/app/Traffic.php +++ b/app/Traffic.php @@ -7,6 +7,4 @@ use Illuminate\Database\Eloquent\Model; class Traffic extends Model { protected $fillable = ['user_id', 'upload', 'download']; - - protected $primaryKey = null; } diff --git a/app/User.php b/app/User.php index 41f026d2..bc145a47 100644 --- a/app/User.php +++ b/app/User.php @@ -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, ]); diff --git a/database/migrations/2020_11_22_101014_create_traffic_table.php b/database/migrations/2020_11_22_101014_create_traffic_table.php index 05416120..9055d476 100644 --- a/database/migrations/2020_11_22_101014_create_traffic_table.php +++ b/database/migrations/2020_11_22_101014_create_traffic_table.php @@ -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'); } } diff --git a/resources/js/components/FilesView/MultiSelected.vue b/resources/js/components/FilesView/MultiSelected.vue index e898962f..84d127b7 100644 --- a/resources/js/components/FilesView/MultiSelected.vue +++ b/resources/js/components/FilesView/MultiSelected.vue @@ -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 { diff --git a/resources/js/main.js b/resources/js/main.js index 0111fdf2..bbc346b9 100644 --- a/resources/js/main.js +++ b/resources/js/main.js @@ -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)