public function index()
 {
     $recentAuctions = Auction::where('FK_status_id', '=', 1)->orWhere('FK_status_id', '=', 3)->orderBy('created_at', 'desc')->take(4)->get();
     $popularAuctions = Auction::with('bidders')->where('FK_status_id', '=', 1)->orWhere('FK_status_id', '=', 3)->get()->sortBy(function ($auction) {
         return $auction->bidders->count();
     })->take(3);
     return View::make('home')->with('recentAuctions', $recentAuctions)->with('popularAuctions', $popularAuctions);
 }
 public function getAuctionPageBySlug($id, $slug)
 {
     try {
         $auction = Auction::where('id', '=', $id)->where('slug', '=', $slug)->firstOrFail();
         // Если аукцион не утвержден его сможет просматривать только администратор
         if ($auction->status == 0) {
             if (Auth::check()) {
                 if (Auth::user()->is_admin != 1) {
                     abort(404);
                 }
             } else {
                 abort(404);
             }
         }
     } catch (\Exception $e) {
         // Если запись не найдена - показываем 404 ошибку
         abort(404);
     }
     // Выбираем документы лота
     $documents = Uploads::where(['auction_id' => $id, 'type' => 'doc'])->get();
     // Текуший курс доллара из настроек
     $currentUSD = Cache::remember('currentUSD', 10, function () {
         return Settings::where(['name' => 'usd_cyr'])->first();
     });
     // Текуший евро доллара из настроек
     $currentEUR = Cache::remember('currentEUR', 10, function () {
         return Settings::where(['name' => 'eur_cyr'])->first();
     });
     $haveBidder = 0;
     $Bidder = null;
     // Загружаем участников аукциона
     $Bidder = Auction::with('bidders')->with('curuser')->find($id);
     // Загружаем ставки
     $Bets = Bets::where('auction_id', '=', $id)->orderBy('created_at', 'desc')->get();
     // Если пользователь авторизован
     if (Auth::check()) {
         // Проверка, является ли текущий пользователь участником
         $BidderCurrent = Bidders::where('user_id', '=', Auth::user()->id)->where('auction_id', '=', $id)->get();
         $haveBidder = $BidderCurrent->count();
     }
     return view('auction.lots.single', ['auction' => $auction, 'documents' => $documents, 'haveBidder' => $haveBidder, 'Bidders' => $Bidder, 'Bets' => $Bets, 'currentUSD' => $currentUSD, 'currentEUR' => $currentEUR]);
 }
 /**
  * Возвращает заявки лота
  */
 public function getAuctionBidders($id)
 {
     $auction = Auction::with('bidders')->find($id);
     return view('dashboard.auctions.bidders', ['auction' => $auction]);
 }
Esempio n. 4
0
 public static function getAuctionWithBuyerForId($id = -1)
 {
     return Auction::with('owner')->find($id);
 }
Esempio n. 5
0
<!doctype html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <title>Протокол</title>
    <link rel="stylesheet" href="{{asset('//uace.com.ua/static/css/bootstrap.css')}}" />
</head>
<body>


<div class="container">
<?php 
$inBidders = null;
$bidders = \App\Auction::with('bidders')->with('curuser')->find($auction_id);
?>

    @if(Auth::check())
        <?php 
$inBidders = \App\Bidders::where(['user_id' => Auth::user()->id, 'auction_id' => $auction_id, 'status' => 1])->get();
?>
        @endif


    @if($bidders->status == 8)
        <div class="text-center" style="padding-top: 50px">


        <h3>Повідомлення</h3>
        <p>про визначення аукціону (відкритих електронних торгів) таким, що не відбувся</p>
            <p>
                Товарна біржа «Українська агропромислова» повідомляє про те, що аукціон з продажу майна продавця – @if($bidders->curuser[0]['legal_entity']) {{ $bidders->curuser[0]['legal_entity'] }} @else {{ $bidders->curuser[0]['first_name'] }} {{ $bidders->curuser[0]['last_name'] }} @endif по лоту №{{ $bidders->id }} ({{ trans('theme.regions.'.$bidders->region) }}@if($bidders->city), {{ $bidders->city }}@endif) не відбувся, у зв’язку з відсутністю заявок на участь у електронних торгах.