当前位置: 首页>>代码示例>>PHP>>正文


PHP Lang::get方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Lang::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::get方法的具体用法?PHP Lang::get怎么用?PHP Lang::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Lang的用法示例。


在下文中一共展示了Lang::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 /**
  * Remove the specified subcategory from storage.
  *
  * @param Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request, $id = null)
 {
     /*
      * --------------------------------------------------------------------------
      * Delete subcategory
      * --------------------------------------------------------------------------
      * Check if selected variable is not empty so user intends to select multiple
      * rows at once, and prepare the feedback message according the type of
      * deletion action.
      */
     if (!empty(trim($request->input('selected_sub')))) {
         $subcategory_ids = explode(',', $request->input('selected_sub'));
         $delete = Subcategory::whereIn('id', $subcategory_ids)->delete();
         $message = Lang::get('alert.subcategory.delete_all', ['count' => $delete]);
     } else {
         $subcategory = Subcategory::findOrFail($id);
         $message = Lang::get('alert.subcategory.delete', ['subcategory' => $subcategory->subcategory]);
         $delete = $subcategory->delete();
     }
     if ($delete) {
         return redirect(route('admin.category.index'))->with(['status' => 'warning', 'message' => $message]);
     } else {
         return redirect()->back()->withErrors(['error' => Lang::get('alert.error.database')]);
     }
 }
开发者ID:anggadarkprince,项目名称:infogue,代码行数:32,代码来源:SubcategoryController.php

示例2: update

 /**
  * Update the resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function update(Request $request)
 {
     $banner = Banner::find(1);
     $data = $request->all();
     $data['images'] = $banner->images ? $banner->images : [];
     $i = 0;
     $files = json_decode($data['files_deleted']);
     foreach ($files as $file) {
         if (($key = array_search($file, $data['images'])) !== false) {
             unset($data['images'][$key]);
             $image = new Image();
             $image->setPath($this->path);
             $image->delete($file);
         }
     }
     foreach ($_FILES['images']['tmp_name'] as $tmpPath) {
         if (!empty($tmpPath)) {
             $fileName = date('His.dmY') . '.' . $i++ . '.jpg';
             $image = new Image();
             $image->setFile($tmpPath);
             $image->setPath($this->path);
             $image->fit(Image::BANNER)->upload($fileName);
             array_push($data['images'], $fileName);
         }
     }
     // Hàm unset() khiến key của array ko còn là dãy số liên tiếp
     // Lúc này Laravel sẽ ko đối xử và lưu 'images' như kiểu array mà là kiểu Json, cần sửa chữa vấn đề này
     $data['images'] = array_values($data['images']);
     $banner->fill($data)->save();
     return Redirect::back()->with('flash_message', Lang::get('system.update'));
 }
开发者ID:khanhpnk,项目名称:sbds,代码行数:37,代码来源:BannerController.php

示例3: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if (!$this->verifyInstalled() || $this->hasRunningDeployments() || $this->composerOutdated() || $this->nodeOutdated() || !$this->checkRequirements()) {
         return -1;
     }
     $bring_back_up = false;
     if (!App::isDownForMaintenance()) {
         $this->error(Lang::get('app.not_down'));
         if (!$this->confirm(Lang::get('app.switch_down'))) {
             return;
         }
         $bring_back_up = true;
         $this->call('down');
     }
     $this->backupDatabase();
     $this->updateConfiguration();
     $this->clearCaches();
     $this->migrate();
     $this->optimize();
     $this->restartQueue();
     $this->restartSocket();
     // If we prompted the user to bring the app down, bring it back up
     if ($bring_back_up) {
         $this->call('up');
     }
 }
开发者ID:rebelinblue,项目名称:deployer,代码行数:31,代码来源:UpdateApp.php

示例4: get

 /**
  * Return a modules.
  *
  * @return \Illuminate\Support\Collection
  */
 public function get(Module $module)
 {
     $moduleName = $module->getName();
     if (Lang::has("{$moduleName}::module.title")) {
         $module->localname = Lang::get("{$moduleName}::module.title");
     } else {
         $module->localname = $module->getStudlyName();
     }
     if (Lang::has("{$moduleName}::module.description")) {
         $module->description = Lang::get("{$moduleName}::module.description");
     }
     $package = $this->packageVersion->getPackageInfo("societycms/module-{$moduleName}");
     if (isset($package->name) && strpos($package->name, '/')) {
         $module->vendor = explode('/', $package->name)[0];
     }
     $module->version = isset($package->version) ? $package->version : 'N/A';
     $module->versionUrl = '#';
     $module->isCore = $this->isCoreModule($module);
     if (isset($package->source->url)) {
         $packageUrl = str_replace('.git', '', $package->source->url);
         $module->versionUrl = $packageUrl . '/tree/' . $package->dist->reference;
     }
     $module->license = $package->license;
     return $module;
 }
开发者ID:SocietyCMS,项目名称:Modules,代码行数:30,代码来源:ModuleManager.php

示例5: getLogout

 /**
  * Logout the user
  * 
  * @return Redirect
  */
 public function getLogout()
 {
     //Logout the user
     Auth::logout();
     //Redirect to login page
     return Redirect::to('admin/login')->with('success', Lang::get('firadmin::admin.messages.logout-success'));
 }
开发者ID:firalabs,项目名称:firadmin,代码行数:12,代码来源:LoginController.php

示例6: latest

 public function latest()
 {
     if ($this->isLoggedIn && $this->request->has('personal') && $this->request->get('personal') == 'true') {
         $isCached = false;
         $bans = $this->repository->getPersonalBans($this->user->settings()->playerIds());
     } else {
         $isCached = Cache::has('bans.latest');
         $bans = $this->repository->getLatestBans();
     }
     if ($this->request->has('type') && $this->request->get('type') == 'rss') {
         $feed = Feed::make();
         $feed->title = sprintf('Latest Battlefield Bans by %s', Config::get('bfacp.site.title'));
         $feed->description = sprintf('Latest Battlefield Bans by %s', Config::get('bfacp.site.title'));
         $feed->setDateFormat('datetime');
         $feed->link = URL::to('api/bans/latest?type=rss');
         $feed->lang = 'en';
         foreach ($bans as $ban) {
             $title = sprintf('%s banned for %s', $ban['player']['SoldierName'], $ban['record']['record_message']);
             $view = View::make('system.rss.ban_entry_content', ['playerId' => $ban['player']['PlayerID'], 'playerName' => $ban['player']['SoldierName'], 'banreason' => $ban['record']['record_message'], 'sourceName' => $ban['record']['source_name'], 'sourceId' => $ban['record']['source_id'], 'banReason' => $ban['record']['record_message']]);
             $feed->add($title, $ban['record']['source_name'], $ban['player']['profile_url'], $ban['ban_startTime'], $title, $view->render());
         }
         return $feed->render('atom');
     }
     return MainHelper::response(['cols' => Lang::get('dashboard.bans.columns'), 'bans' => $bans], null, null, null, $isCached, true);
 }
开发者ID:BP4U,项目名称:BFAdminCP,代码行数:25,代码来源:BansController.php

示例7: auth

 /**
  * Ensure user is logged in
  *
  * @return
  */
 public function auth()
 {
     if (!$this->auth->check()) {
         $redirect = '?redirect=' . urlencode(Request::path());
         return Redirect::to('/auth/login' . $redirect)->with('error_message', Lang::get('messages.login_access_denied'));
     }
 }
开发者ID:Ajaxman,项目名称:SaleBoss,代码行数:12,代码来源:SimpleAccessFilter.php

示例8: show

 public function show(Tag $tag)
 {
     $posts = Tag::find($tag->id)->posts()->latest()->get();
     $title = Lang::get('tags.index.title', ['tag' => $tag->name]);
     $header = Lang::get('tags.index.header', ['tag' => $tag->name]);
     return view('posts.index', compact('posts', 'title', 'header'));
 }
开发者ID:itainathaniel,项目名称:blog,代码行数:7,代码来源:TagsController.php

示例9: __construct

 public function __construct()
 {
     parent::__construct(Lang::get('oauth.unauthorized_client'), 14002);
     $this->httpStatusCode = 401;
     $errorType = class_basename($this);
     $this->errorType = snake_case(strtr($errorType, array('Exception' => '')));
 }
开发者ID:safarishi,项目名称:laravel4api,代码行数:7,代码来源:UnauthorizedClientException.class.php

示例10: convert

 public function convert()
 {
     $validator = Validator::make(Input::all(), ['from' => 'required|min:3|max:3', 'to' => 'required|min:3|max:3']);
     if ($validator->fails()) {
         return response()->json([$validator->errors()])->setStatusCode(422, 'Validation Failed');
     }
     $from = Currency::find(Input::get('from'));
     $to = Currency::find(Input::get('to'));
     $precision = (int) Config::get('laravel-currency.laravel-currency.precision');
     $multiplier = pow(10, (int) Config::get('laravel-currency.laravel-currency.precision'));
     $amount = (double) Input::get('amount') ?: 1;
     if ($from == $to) {
         return response()->json($amount);
     }
     $amount = round($amount * $multiplier);
     if ($from && ($from->base == Input::get('to') || $from->base == $to->code)) {
         return response()->json(round($amount / $from->price, $precision));
     }
     if ($to && ($to->base == Input::get('from') || $to->base == $from->code)) {
         return response()->json(round($amount * $to->price / pow($multiplier, 2), $precision));
     }
     if (!$from || !$to) {
         return response()->json(['error' => Lang::get('currency.error.not_found')])->setStatusCode(404, 'Currency Not Found');
     }
     if ($from->base !== $to->base) {
         throw new Exception('Cannot convert currencies with different bases.');
     }
     return response()->json(round($amount / $from->price * $to->price / $multiplier, $precision));
 }
开发者ID:Rolice,项目名称:LaravelCurrency,代码行数:29,代码来源:CurrencyController.php

示例11: getCurrentUserId

 /**
  * Attempt to find the user id of the currently logged in user
  * Supports Cartalyst Sentry/Sentinel based authentication, as well as stock Auth.
  *
  * Thanks to https://github.com/VentureCraft/revisionable/blob/master/src/Venturecraft/Revisionable/RevisionableTrait.php
  *
  * @throws NoUserLoggedInException
  *
  * @return int|string|null
  */
 protected static function getCurrentUserId()
 {
     /*
      * Check if we're allowed to return no user ID to the model, if so we'll return NULL
      */
     if (Config::get('inventory' . InventoryServiceProvider::$packageConfigSeparator . 'allow_no_user')) {
         return;
     }
     /*
      * Accountability is enabled, let's try and retrieve the current users ID
      */
     try {
         if (class_exists($class = '\\Cartalyst\\Sentry\\Facades\\Laravel\\Sentry') || class_exists($class = '\\Cartalyst\\Sentinel\\Laravel\\Facades\\Sentinel')) {
             if ($class::check()) {
                 return $class::getUser()->id;
             }
         } elseif (class_exists('Illuminate\\Auth') || class_exists('Illuminate\\Support\\Facades\\Auth')) {
             if (\Auth::check()) {
                 return \Auth::user()->getAuthIdentifier();
             }
         }
     } catch (\Exception $e) {
     }
     /*
      * Couldn't get the current logged in users ID, throw exception
      */
     $message = Lang::get('inventory::exceptions.NoUserLoggedInException');
     throw new NoUserLoggedInException($message);
 }
开发者ID:johnny-human,项目名称:uhlelo,代码行数:39,代码来源:UserIdentificationTrait.php

示例12: __construct

 public function __construct()
 {
     //        $this->middleware('auth');
     // Fetch the Site Settings object
     $this->currentModelName = Lang::get('crud.shiaiCategory');
     View::share('currentModelName', $this->currentModelName);
 }
开发者ID:xoco70,项目名称:KendoOnline,代码行数:7,代码来源:ShiaiCategoryController.php

示例13: removeUserFromGroup

 /**
  * Remove user from a specified group
  *
  * @param $userId
  * @param $groupId
  * @return \Illuminate\Http\Response
  */
 public function removeUserFromGroup($groupId, $userId)
 {
     $group = UserGroup::find($groupId);
     $group->users()->detach($userId);
     Flash::success(Lang::get('users_groups.update-success'));
     return redirect(action('UsersManagementController@index') . '#orgagroupsaccess');
 }
开发者ID:iris-it,项目名称:irispass-webapp-laravel,代码行数:14,代码来源:UsersGroupsController.php

示例14: index

 public function index()
 {
     $title = Lang::get('lang.destinations');
     $destinations = Destinations::where('active', '=', 1)->where('isDomestic', '=', '1')->orderBy('ordering')->paginate(6);
     $destinations->setPath('destinations');
     return view('destinations.index', compact('destinations', 'title'));
 }
开发者ID:asker-hr,项目名称:laravel3,代码行数:7,代码来源:DestinationsController.php

示例15: setPassword

 public function setPassword()
 {
     if ($this->request->method() === 'GET') {
         return $this->showForm(['token' => $this->request->input('token')]);
     }
     $person = Person::findByEmail($this->request->input('email'));
     if (!$person->isValid()) {
         return $this->showForm(['error' => Lang::get('boomcms::recover.errors.invalid_email'), 'token' => $this->request->input('token')]);
     }
     $tokens = $this->app['auth.password.tokens'];
     $token = $tokens->exists($person, $this->request->input('token'));
     if (!$token) {
         return $this->showForm(['error' => Lang::get('boomcms::recover.errors.invalid_token'), 'token' => $this->request->input('token')]);
     }
     if ($this->request->input('password1') != $this->request->input('password2')) {
         return $this->showForm(['error' => Lang::get('boomcms::recover.errors.password_mismatch'), 'token' => $this->request->input('token')]);
     }
     if ($this->request->input('password1') && $this->request->input('password2')) {
         $tokens->delete($token);
         $tokens->deleteExpired();
         $person->setEncryptedPassword($this->auth->hash($this->request->input('password1')));
         Person::save($person);
         $this->auth->login($person);
         return redirect('/');
     } else {
         return $this->showForm(['error' => Lang::get('boomcms::recover.errors.password_mismatch'), 'token' => $this->request->input('token')]);
     }
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:28,代码来源:Recover.php


注:本文中的Illuminate\Support\Facades\Lang::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。