Базовый контроллер laravel 4 setuplayout метод конвертирования в laravel 5 view share не работает

//base controller layout method please correct it.
protected function setupLayout()
{
$user = \Auth::user();
if (!is_null($user)) {
$countries = [];
// $message = Member::find("id_member_status",`enter code here` "=", 9)->get();

// if ($message) {

//     return \View::make('member::block.message_member');

// } else{

//     return 'Teste';

// }$notification = Notification::where('id_member','=',\Auth::id())
->count();

if($notification > 0):
$notification_msg = Notification::with('notificationTitle')
->where('id_member','=',\Auth::id())
->orderBy('read','ASC')
->orderBy('id_notification','DESC')
->take(30)
->get();

$notification_unread = Notification::where('id_member','=',\Auth::id())
->where('read','=','0')
->count();

if($notification_unread > 0):
$notification = 1;
else:
$notification = 0;
endif;

else:
$notification_msg = null;
endif;

$balance = $user->balance();
$years   = $user->proceedings()
->where("id_status", Proceeding::STATUS_CONCLUDED)
->where("id_source_description", Proceeding::SOURCE_WITHDRAW)
->groupBy(\DB::raw("YEAR(updated_at)"))
->get([\DB::raw("YEAR(updated_at) as year")])
->lists("year");

//selects all convertitos points for qualifying
$currentPointsConverted = \Auth::user()
->points()
->where("id_source_description", PointSourceDescription::POINT_CONVERTED_SMALLER)
->whereIn("id_type", array(Points::POINT_TYPE_CONVERTED_POINTS, Points::POINT_TYPE_CONVERTED_ROYALTY))
->sum("point") * (-1);

if (is_null(\Auth::user()->nextClassification())) {

$percent = 100;

} else {

//initial points
$initialPoint = \Auth::user()->Classification()->points;

//final points
$finalPoint = \Auth::user()->nextClassification()->points;

//current points
$currentPointsConverted = $currentPointsConverted;

//endpoints least starting points
$finalFewerInitialPoint = $finalPoint - $initialPoint;

//Current points lower thresholds
$currentFewerInitialPoint = $currentPointsConverted - $initialPoint;

//calculating the percentage
$percent = round(($currentFewerInitialPoint * 100) / $finalFewerInitialPoint, 2);
$percent = $percent > 100 ? 100 : $percent;

}

$findSettings = Settings::where("setting_name", "=", "module_customer")->first();

$moduleCustomer = $findSettings->setting_value;

$weekBalance = array(
(int)$user->getBalanceUntilDate(date('Y-m-d', strtotime('-6 days'))),
(int)$user->getBalanceUntilDate(date('Y-m-d', strtotime('-4 days'))),
(int)$user->getBalanceUntilDate(date('Y-m-d', strtotime('-3 days'))),
(int)$user->getBalanceUntilDate(date('Y-m-d', strtotime('-2 days'))),
(int)$user->getBalanceUntilDate(date('Y-m-d', strtotime('-1 days'))),
(int)$user->balance()
);
$countries = $country = array_map(function ($k) {
return $k[0];
}, \Config::get('app.available_languages'));$ProceedingAwaitingReceipt = Proceeding::whereIn('net_proceeding.id_status', array(
Status::STATUS_AWAITING_RECEIPT
)
)->where('net_proceeding.id_requestor', '=', \Auth::id())
->where('id_source_description', '=', Description::SOURCE_WITHDRAWN)
->join('net_withdraw', 'net_withdraw.id_proceeding', '=', 'net_proceeding.id_proceeding')
->count();

\View::share(
array(
"pending_p"        => (Member::STATUS_WAITING_PAYMENT == $user->id_member_status),
"pending_document" => !$user->haveDocumentBeenSended(),
"years"            => $years,
"user"             => $user,
"percent"          => $percent,
"weekBalance"      => $weekBalance,
"moduleCustomer"   => $moduleCustomer,
"notification"     => $notification,
"notification_msg" => $notification_msg,
"countries"        => $countries,
"hasUnreadTicket"  => Ticket::hasUnreadAnswer('user'),
"currentPointsConverted" => $currentPointsConverted,
"ProceedingAwaitingReceipt" => $ProceedingAwaitingReceipt,
)
);
}

if (!is_null($this->layout)) {
$this->layout = \View::make($this->layout);
}
}
}

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]