<?php
var_dump(unpack('C*', hash_hmac('sha256', 'Just simple test string', 'Very_secret_key!', true)));
select * from news order by (id > ИД_ТЕКУЩЕЙ НОВОСТИ) desc, id limit 5;
$query = 'UPDATE `walets` SET BNB=IFNULL(BNB, "‘.$BNB.’”), BUSD=IFNULL(BUSD, "‘.$BUSD.’”),TRX=IFNULL(TRX, "‘.$TRX.’”), USDT=IFNULL(USDT, "'.$USDT.'")';
<?php
class Node
{
public $data;
public $next;
function __construct($data, $next = null)
{
$this->data = $data;
$this->next = $next;
}
}
class LinkedList{
public $head = null;
public function push(Node $node){
if($this->head == null){
$this->head = $node;
return $this;
}
$current = $this->head;
while($current->next != null) {
$current = $current->next;
}
$current->next = $node;
return $this;
}
public function cut(int $index){
if($index == 0){
$this->head = $this->head->next;
return $this;
}
$i = 0;
$previous = null;
$current = $this->head;
do {
if($i == $index){
$previous->next = $current->next;
return $this;
}
$previous = $current;
$i++;
}while(($current = $current->next) != null);
throw new Exception('Надо эксепшен что бы out of bounds');
}
public function printList()
{
if(!$this->head){
echo 'empty list'.PHP_EOL;
return $this;
}
$current = $this->head;
echo $current->data.' -> ';
while (($current = $current->next)) {
echo $current->data;
if($current->next) {
echo ' -> ';
}
}
echo PHP_EOL;
return $this;
}
}
$linkedList = new LinkedList();
$linkedList
->push(new Node('Ari'))
->push(new Node('Malcolm'))
->push(new Node('Pete'))
->push(new Node('Ricky'))
->push(new Node('Sean'));
$linkedList
->printList()
->cut(2)
->printList()
->cut(1)
->printList()
->cut(10);
$a_data = array_merge($a_data, array_fill(0, 100, 0));
Product::whereDoesntHave('collections', function (Builder $query) {
return $query->whereIn('id', [15]);
})->orderBy('created_at', 'desc')->limit(4)->get();
<table>
<tr>
<th>Имя</th><th>Фамилия</th><th>Email</th>
</tr>
<tr>
<td><input name="name[]"></td><td><input name="family[]"></td><td><input name="email[]"></td>
</tr>
<tr>
<td><input name="name[]"></td><td><input name="family[]"></td><td><input name="email[]"></td>
</tr>
<tr>
<td><input name="name[]"></td><td><input name="family[]"></td><td><input name="email[]"></td>
</tr>
<tr>
<td><input name="name[]"></td><td><input name="family[]"></td><td><input name="email[]"></td>
</tr>
</table>
<?php
$options = array('http' =>
[
'method' => 'GET',
'header' => "X-Auth-Token: <token>\r\n"
]
);
$context = stream_context_create($options);
$result = file_get_contents('https://kaspi.kz/shop/api/v2/orders?page[number]=0&page[size]=20&filter[orders][state]=NEW
&filter[orders][creationDate][$ge]=1478736000000&filter[orders][creationDate][$le]=1479945600000
&filter[orders][status]=APPROVED_BY_BANK&filter[orders][deliveryType]=PICKUP
&filter[orders][signatureRequired]=false&include[orders]=user', false, $context);
var_dump($result);
public function index()
{
$mods = Mod::with('categories')
->with('mod_author')
->with(['files' => function($query){
return $query->where('type', 'mod');
}])
->paginate('10');
return ModResource::collection($mods);
}
public function toArray($request)
{
return [
'id' => $this->id,
'title' => $this->title,
'slug' => $this->slug,
'author' => new AuthorResource($this->mod_author),
'sticky' => $this->sticky,
'categories' => CategoryResource::collection($this->categories),
'files' => $this->whenLoaded('files', [
'archives' => $this->files,
])
];
}