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
model User | |
``` | |
public function latestItem() | |
{ | |
return $this->hasOne(Item::class)->latestOfMany(); | |
} | |
``` | |
model Item | |
``` |
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
protected function getOrderList() | |
{ | |
$arr = []; | |
$currentUser = $this->data['user']['id'] ?? 0; | |
if(!empty($currentUser)) { | |
$arr = app('evouser')->do('OrderList', [ 'user' => $currentUser ]); | |
} | |
if(!empty($arr['data'])) { | |
//print_r($arr['data']); |
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
//<input type="file" data-upload-file> | |
//<input type="file" multiple data-upload-file> | |
//ловим в файле ajax.php $_FILES['files'] и $_POST['action'] == "uploadFiles" | |
$(document).on("change", "[data-upload-file]", function(e){ | |
e.preventDefault(); | |
const formData = new FormData(); | |
formData.append("action", "uploadFiles"); | |
for(let k = 0; k < e.target.files.length; k++) { | |
formData.append("files[" + k + "]", e.target.files[k]); |
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
<div class="row"> | |
<div class="col-sm-12 col-md-5"> | |
<div class="dataTables_info">Показано {{ $paginator->firstItem() }} - {{ $paginator->lastItem() }} из {{ $paginator->total() }}</div> | |
</div> | |
<div class="col-sm-12 col-md-7"> | |
@if($paginator->hasPages()) | |
<div class="dataTables_paginate paging_simple_numbers" > | |
<ul class="pagination"> | |
@if(!$paginator->onFirstPage()) |
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 EvolutionCMS\Main; | |
//положить файл в папку core/custom/packages/Main/src/ | |
//для использования в любом другом месте добавить use EvolutionCMS\Main\Helper; | |
use Illuminate\Support\Carbon; | |
use Illuminate\Support\Facades\Cache; | |
use Illuminate\Support\Facades\DB; | |
use Illuminate\Support\Str; |