Fix uploading texture

This commit is contained in:
Pig Fang 2019-03-16 16:32:49 +08:00
parent 19001b16dc
commit 5235ac23b0
3 changed files with 34 additions and 2 deletions

View File

@ -179,7 +179,6 @@ class SkinlibController extends Controller
$t->size = ceil($request->file('file')->getSize() / 1024);
$t->public = $request->input('public') == 'true';
$t->uploader = $user->uid;
$t->upload_at = get_datetime_string();
$cost = $t->size * ($t->public ? Option::get('score_per_storage') : Option::get('private_score_per_storage'));
$cost += option('score_per_closet_item');

View File

@ -7,7 +7,8 @@ use Illuminate\Database\Eloquent\Model;
class Texture extends Model
{
public $primaryKey = 'tid';
public $timestamps = false;
public const CREATED_AT = 'upload_at';
public const UPDATED_AT = null;
protected $casts = [
'tid' => 'integer',

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveLikesField extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (Schema::hasColumn('textures', 'likes')) {
Schema::table('textures', function (Blueprint $table) {
$table->dropColumn('likes');
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Do nothing.
}
}