diff --git a/app/Models/Service.php b/app/Models/Service.php index 9cf46a1c9864f8c741b33a9ff18f9c5c1f11ab85..19336186ef7914b7a505b76a1ba61c322a8ce89a 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -8,4 +8,8 @@ class Service extends Model { // protected $table = 'services'; + + public function user(){ + return $this->belongsTo(User::class); + } } diff --git a/app/Models/User.php b/app/Models/User.php index 6bd0f15711fbcc96566c38465c5124e2c1212e70..d70dc44e83a4f9f4d284adb5b5b8cd212d1f8c95 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -26,4 +26,8 @@ class User extends Authenticatable protected $hidden = [ 'password', 'remember_token', ]; + + public function services(){ + return $this->hasMany(Service::class); + } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 35471f6ff156325ed0fdb98b03e611c2cd43f675..d74b5deac66e47cb8b67f6959739134e966d2a98 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use Carbon\Carbon; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -14,6 +15,7 @@ class AppServiceProvider extends ServiceProvider public function boot() { // + Carbon::setLocale('zh'); } /** diff --git a/database/migrations/2018_05_05_212011_create_gift_table.php b/database/migrations/2018_05_05_212011_create_gift_table.php new file mode 100644 index 0000000000000000000000000000000000000000..418ccd4c4be185afb482c9295e3d290c5a8c1509 --- /dev/null +++ b/database/migrations/2018_05_05_212011_create_gift_table.php @@ -0,0 +1,35 @@ +increments('id'); + $table->string('name')->comment('礼物名称'); + $table->float('price')->comment('礼物价格'); + $table->float('discount')->comment('折扣')->nullable(); + $table->string('beizhu')->comment('备注')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('gift'); + } +} diff --git a/database/migrations/2018_05_05_212616_create_gift_record_table.php b/database/migrations/2018_05_05_212616_create_gift_record_table.php new file mode 100644 index 0000000000000000000000000000000000000000..f4a504bfafa8a3534fa03ee1ddf7dd2595f2aa5f --- /dev/null +++ b/database/migrations/2018_05_05_212616_create_gift_record_table.php @@ -0,0 +1,38 @@ +increments('id'); + $table->integer('send_id')->comment('送礼用户id')->index(); + $table->integer('acc_id')->comment('收礼用户id')->index(); + $table->integer('gift_id')->comment('礼物id'); + $table->integer('num')->comment('赠送数量'); + $table->float('price')->comment('礼物单价'); + $table->float('discount')->comment('折扣')->nullable(); + $table->float('amount')->comment('合计金额')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('gift_record'); + } +} diff --git a/database/migrations/2018_05_05_213440_create_call_record_table.php b/database/migrations/2018_05_05_213440_create_call_record_table.php new file mode 100644 index 0000000000000000000000000000000000000000..4db391294f339c10ae3a943057f302f940fd6b11 --- /dev/null +++ b/database/migrations/2018_05_05_213440_create_call_record_table.php @@ -0,0 +1,33 @@ +increments('id'); + $table->integer('user_id')->comment('用户自增id')->index(); + $table->integer('call_id')->comment('被呼叫的用户id')->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('call_record'); + } +}