From 5235ac23b0f96160c670bd8e6ab77feb1c18ac74 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Sat, 16 Mar 2019 16:32:49 +0800 Subject: [PATCH] Fix uploading texture --- app/Http/Controllers/SkinlibController.php | 1 - app/Models/Texture.php | 3 +- .../2019_03_16_162603_remove_likes_field.php | 32 +++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 database/migrations/2019_03_16_162603_remove_likes_field.php diff --git a/app/Http/Controllers/SkinlibController.php b/app/Http/Controllers/SkinlibController.php index 8756259d..e9c23972 100644 --- a/app/Http/Controllers/SkinlibController.php +++ b/app/Http/Controllers/SkinlibController.php @@ -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'); diff --git a/app/Models/Texture.php b/app/Models/Texture.php index f941618a..5007a1b3 100644 --- a/app/Models/Texture.php +++ b/app/Models/Texture.php @@ -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', diff --git a/database/migrations/2019_03_16_162603_remove_likes_field.php b/database/migrations/2019_03_16_162603_remove_likes_field.php new file mode 100644 index 00000000..6a1b8ff9 --- /dev/null +++ b/database/migrations/2019_03_16_162603_remove_likes_field.php @@ -0,0 +1,32 @@ +dropColumn('likes'); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // Do nothing. + } +}