dd/app/Models/BookHook.php
2025-06-10 17:16:53 +08:00

50 lines
904 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($sType)
// {
// $oData = first();
//
// return $oData;
// }
//
// public static function _first_key($sType)
// {
// $sKey = self::where("type", $sType)->first()?->key;
//
// return $sKey;
// }
public static function _first_path()
{
$oSelf = self::first()?->path;
return $oSelf;
}
public static function _cd($sPath)
{
DB::table('book_hook')->truncate();
$oBookHook = new self();
$oBookHook->path = $sPath;
$r = $oBookHook->save();
return $r;
}
}