50 lines
904 B
PHP
Executable File
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;
|
|
|
|
}
|
|
|
|
}
|