dd/app/Models/BookHook.php
2025-07-15 17:08:34 +08:00

37 lines
796 B
PHP
Executable File

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class BookHook extends Model
{
protected $table = 'book_hook';
public $timestamps = false;
public static function _first_path($aUpdate)
{
$sUser = $aUpdate["message"]["from"]["first_name"];
$oSelf = self::where("user", $sUser)->first()?->path;
return $oSelf;
}
public static function _cd($sPath, $aUpdate)
{
$sUser = $aUpdate["message"]["from"]["first_name"];
self::where("user", $sUser)->delete();
$oBookHook = new self();
$oBookHook->path = $sPath;
$oBookHook->user = $sUser;
$r = $oBookHook->save();
return $r;
}
}