本文整理汇总了PHP中app\Language::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::orderBy方法的具体用法?PHP Language::orderBy怎么用?PHP Language::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Language
的用法示例。
在下文中一共展示了Language::orderBy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if (Request::isMethod('get')) {
$lang = Language::orderBy('id', 'desc')->get();
return view('admin.language.list', array('langs' => $lang));
}
/*
When create a language. System will scan in English folder (default language)
to get all files avaliable to translate. Then create all new file with same name
in English folder
*/
$data = Request::all();
$main_folder = base_path() . '/resources/lang/';
$exist_folder = file_exists($main_folder . $data['code']);
if ($exist_folder) {
return 'exist_folder';
} else {
mkdir($main_folder . $data['code']);
// get all file in English and make a new copy same name in new language
/*$list_files = array_diff(scandir($main_folder.'en'),array('..', '.'));
foreach($list_files as $file){
fopen($main_folder.$data['code'].'/'.$file, "w");
}
*/
}
$l = new Language();
$l->name = $data['name'];
$l->code = $data['code'];
$l->save();
}
示例2: edit
/**
* Show the form for editing the specified resource.
*
* @param \App\Product $product
* @return \Illuminate\Http\Response
*/
public function edit(Product $product)
{
$productVariants = Product_variant::where('product_id', $product->product_id)->get();
$languages = Language::orderBy('order', 'asc')->get();
$categories = Category::all();
$discounts = Discount::all();
$taxes = Tax::all();
return view('intothesource.webshop.products.edit', compact('product', 'productVariants', 'languages', 'categories', 'discounts', 'taxes'));
}
示例3: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
// Available languages
$view->with('languages', $languages = Language::orderBy('name')->get());
// Available languages but current one
$appLanguage = app('language');
$view->with('languagesButCurrent', $languages->filter(function ($l) use($appLanguage) {
return $l->id != $appLanguage->id;
}));
// All languages
//$view->with('allLanguages', Language::orderBy('name')->withTrashed()->get());
}
示例4: index
public function index()
{
$websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
$aboutMe = AboutMe::orderBy('sortorder', 'asc')->get();
$experiences = Experience::orderBy('dateStart', 'desc')->get();
$skills = Skills::orderBy('sortorder', 'asc')->get();
$languages = Language::orderBy('sortorder', 'asc')->get();
//foreach($languages as $language):
//dd($language->writeName);
//endforeach;
return view('website.aboutme')->with(compact('websiteSettings', 'aboutMe', 'experiences', 'skills', 'languages'));
}
示例5: showForm
/**
* Display a form for saving a resource.
*
* @param string $subtitle Page subtitle.
* @param string $action Form route sufix.
* @param string $method Form method.
* @return Response
*/
protected function showForm($subtitle, $action, $method = 'POST')
{
view()->share(['languages' => \App\Language::orderBy('name')->withTrashed()->lists('name', 'id'), 'providers' => \App\Provider::orderBy('name')->withTrashed()->lists('name', 'id'), 'role' => \App\Role::orderBy('name')->lists('name', 'id')]);
return parent::showForm($subtitle, $action, $method);
}
示例6: camposTraduccion
public function camposTraduccion($id)
{
$product = Product::findOrFail($id);
$languages = Language::orderBy('name', 'asc')->get();
$arrayLan = null;
foreach ($languages as $lan) {
$arrayLan[$lan->id] = ['name' => '', 'description' => ''];
$langProds = LanguageProduct::where('id_product', $product->id)->where('id_language', $lan->id);
if ($langProds->count() > 0) {
$langProds = $langProds->first();
$arrayLan[$lan->id] = ['name' => $langProds->name, 'description' => $langProds->description];
}
}
return ['arrayLan' => $arrayLan, 'languages' => $languages, 'product' => $product];
}
示例7: camposTraduccion
public function camposTraduccion($id)
{
$categoria = Category::findOrFail($id);
$languages = Language::orderBy('name', 'asc')->get();
$arrayLan = null;
foreach ($languages as $lan) {
$arrayLan[$lan->id] = ['name' => ''];
$langCats = LanguageCategory::where('id_category', $categoria->id)->where('id_language', $lan->id);
if ($langCats->count() > 0) {
$langCats = $langCats->first();
$arrayLan[$lan->id] = ['name' => $langCats->name];
}
}
return ['arrayLan' => $arrayLan, 'languages' => $languages, 'category' => $categoria];
}
示例8: index
/**
* Show the application welcome screen to the user.
*
* @return Response
*/
public function index()
{
$languages = \App\Language::orderBy('name')->get();
// echo Request::cookie('user_language');
return view('welcome')->with(compact('languages'));
}
示例9: getOrder
public function getOrder()
{
if (!ACL::hasPermission('languages', 'edit')) {
return redirect(route('languages'))->withErrors(['You don\'t have permission for edit the language.']);
}
$languages = Language::orderBy('sortorder', 'ASC')->addSelect('languageId')->addSelect('languageName')->addSelect('flag')->addSelect('sortorder')->get();
return view('admin.language.order')->with(compact('languages'));
}