本文整理汇总了PHP中app\Language::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::get方法的具体用法?PHP Language::get怎么用?PHP Language::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Language
的用法示例。
在下文中一共展示了Language::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAll
public function getAll()
{
// Get All Languages
$languages = Language::get();
// Passing data to response service
return $this->responseService->returnMessage($languages, 'No Languages were Found.');
}
示例2: guardarTraduccion
public function guardarTraduccion($request, $id)
{
$producto = Product::findOrFail($id);
$producto->name = $request->input('name');
$producto->description = $request->input('description');
$producto->save();
$languages = Language::get();
foreach ($languages as $lang) {
$nameLang = $request->input('name' . $lang->id);
$descLang = $request->input('description' . $lang->id);
if (trim($nameLang) != "" && trim($descLang) != "") {
$languages_products = LanguageProduct::where('id_language', $lang->id)->where('id_product', $producto->id)->first();
if (!isset($languages_products->id)) {
$languages_products = new LanguageProduct();
}
$languages_products->id_language = $lang->id;
$languages_products->id_product = $producto->id;
$languages_products->name = $nameLang;
$languages_products->description = $descLang;
$languages_products->save();
} else {
$languages_products = LanguageProduct::where('id_language', $lang->id)->where('id_product', $producto->id)->first();
if (isset($languages_products->id)) {
$languages_products->delete();
}
}
}
}
示例3: guardarTraduccion
public function guardarTraduccion($request, $id)
{
$categoria = Category::findOrFail($id);
$categoria->name = $request->input('name');
$categoria->save();
$languages = Language::get();
foreach ($languages as $lang) {
$nameLang = $request->input('name' . $lang->id);
if (trim($nameLang) != "") {
$languages_categories = LanguageCategory::where('id_language', $lang->id)->where('id_category', $categoria->id)->first();
if (!isset($languages_categories->id)) {
$languages_categories = new LanguageCategory();
}
$languages_categories->id_language = $lang->id;
$languages_categories->id_category = $categoria->id;
$languages_categories->name = $nameLang;
$languages_categories->save();
} else {
$languages_categories = LanguageCategory::where('id_language', $lang->id)->where('id_category', $categoria->id)->first();
if (isset($languages_categories->id)) {
$languages_categories->delete();
}
}
}
}