commit
af80e4835e
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class VisitLog extends CommonModel
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public static function add($admin, $user, $visit_id, $remark)
|
||||
{
|
||||
return self::create([
|
||||
'admin_id' => $admin->id ?? 0,
|
||||
'department_id' => $admin->department_id ?? 0,
|
||||
'user_id' => $user->id ?? 0,
|
||||
'visit_id' => $visit_id,
|
||||
'remark' => $remark
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateVisitLogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('visit_logs', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('admin_id')->nullable();
|
||||
$table->integer('department_id')->nullable();
|
||||
$table->integer('user_id')->nullable();
|
||||
$table->integer('visit_id')->nullable();
|
||||
$table->string('remark')->nullable();
|
||||
$table->dateTime('created_at')->nullable();
|
||||
$table->dateTime('updated_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('visit_logs');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue