本文整理汇总了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);
}
}