This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function buildUpdateQuery($table, $update) | |
{ | |
$qr = "update ".$table." set "; | |
$cases = []; | |
$ids = []; | |
foreach ($update as $key => $val) { | |
$ids[] = $val['id']; | |
foreach ($val['data'] as $k => $v) { | |
$cases[$k][] = "when ".$val['id']." then '".$v."'"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TemparatureConvert | |
{ | |
private function kelToCel($num) | |
{ | |
return round($num - 273.15, 2); | |
} | |
private function celToFar($num) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM holiday_roaster where as_id in (select leave_ass_id from hr_leave where leave_from <= '2020-10-30' and leave_to >= '2020-10-30') and date = '2020-10-30' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Validator; | |
use App\Post; | |
class PostController extends Controller | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Post extends Model | |
{ | |
//................................... | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function domPost($content) | |
{ | |
libxml_use_internal_errors(true); | |
$dom = new \DomDocument(); | |
$dom->loadHtml('<?xml encoding="utf-8" ?>'.$content); // must include this to avoid font problem | |
$images = $dom->getElementsByTagName('img'); | |
if(count($images)>0) | |
{ | |
foreach($images as $k => $img) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post extends Model | |
{ | |
……………………………………. | |
public function next() | |
{ | |
return $this->where(‘id’, ‘>’, $this->id)->orderBy(‘id’,’asc’)->first(); | |
} | |
public function previous() | |
{ | |
return $this->where(‘id’, ‘<’, $this->id)->orderBy(‘id’,’desc’)->first(); |