本文整理匯總了PHP中App\Http\Controllers\App::getLocale方法的典型用法代碼示例。如果您正苦於以下問題:PHP App::getLocale方法的具體用法?PHP App::getLocale怎麽用?PHP App::getLocale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類App\Http\Controllers\App
的用法示例。
在下文中一共展示了App::getLocale方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
$pages = Page::all();
$landing = Landing::where('lang', \App::getLocale())->first();
$universities = University::where('lang', \App::getLocale())->take(9)->get();
return view('pages.index', ['pages' => $pages, 'landing' => $landing, 'universities' => $universities]);
}
示例2: __construct
public function __construct()
{
switch (\App::getLocale()) {
case 'ru':
$this->localeDir = 'ru.';
break;
default:
$this->localeDir = '';
}
}
示例3: page
/**
* Show the appropriate view depending on the slug.
*
* YOU MAY WANT TO MODIFY THIS
* Right now it only loads some dummy views.
*
* @return Response
*/
public function page($slug)
{
// get the corresponding page for that slug
$page = Page::findBySlugOrId($slug)->withFakes();
// if there is such a page
if ($page && $page->translation_lang == \App::getLocale()) {
// load the proper template
return view('page_templates.' . $page->template, ['page' => $page]);
}
abort(404);
}
示例4: __construct
public function __construct()
{
$this->middleware('admin');
switch (\App::getLocale()) {
case 'ru':
$this->localeDir = 'ru.';
break;
default:
$this->localeDir = '';
}
}
示例5: question
public function question(Request $request)
{
$this->validate($request, ['title' => 'required|exists:auctions,title', 'question' => 'required']);
if ($request->input('confirmed')) {
$auction = Auction::where('title', $request->input('title'))->first();
$recipient = $auction->seller_id;
$data = ['sender' => User::find(Auth::user()->id), 'message' => $request->input('question'), 'title' => $request->input('title'), 'recipient' => $recipient];
Message::ask($data);
Session::flash('flash_message', trans('messages.question.sent'));
return redirect(\App::getLocale() . '/art');
} else {
return view('auctions.ask_conf')->with('message', $request);
}
}