本文整理汇总了PHP中trans函数的典型用法代码示例。如果您正苦于以下问题:PHP trans函数的具体用法?PHP trans怎么用?PHP trans使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trans函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update(User $user, UserRequest $request)
{
$user->update($request->all());
$user->roles()->sync($request->input('roleList'));
Flash::success(trans('general.updated_msg'));
return redirect(route('admin.users'));
}
示例2: translatableLabel
/**
* Return the translatable label.
*
* @param string $size
* @return null|string
*/
protected function translatableLabel($size = 'sm')
{
if ($this->object->isTranslatable()) {
return '<span class="label label-info label-' . $size . '">' . trans('streams::assignment.translatable.name') . '</span>';
}
return null;
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::user()->id == 1) {
return $next($request);
}
return redirect()->guest('login')->withErrors(trans('auth.admin'));
}
示例4: editCustomRecord
public function editCustomRecord($parameters)
{
$parameters['outgoingSecures'] = [(object) ['id' => '', 'name' => trans('pulsar::pulsar.no_security')], (object) ['id' => 'ssl', 'name' => 'SSL'], (object) ['id' => 'tls', 'name' => 'TLS'], (object) ['id' => 'sslv2', 'name' => 'SSLv2'], (object) ['id' => 'sslv3', 'name' => 'SSLv3']];
$parameters['incomingTypes'] = [(object) ['id' => 'imap', 'name' => 'IMAP']];
$parameters['incomingSecures'] = [(object) ['id' => '', 'name' => trans('pulsar::pulsar.no_security')], (object) ['id' => 'ssl', 'name' => 'SSL']];
return $parameters;
}
示例5: getUser
/**
* @return User
* @throws ReflinkException
*/
public function getUser()
{
if (is_null($user = User::where('email', $this->email)->first())) {
throw new ReflinkException(trans(Password::INVALID_USER));
}
return $user;
}
示例6: sendConfirmationEmail
/**
* Sends the event's confirmation email to the advisor.
*
* @var $event App\Event
*/
public function sendConfirmationEmail()
{
Mail::raw($this->confirmationMessage(), function ($message) {
$message->subject(trans('confirmation.subject', ['event' => $this->event->name]));
$message->to($this->email);
});
}
示例7: archive
public function archive($publicId)
{
$branch = Branch::scope($publicId)->firstOrFail();
$branch->delete();
Session::flash('message', trans('texts.archived_branch'));
return Redirect::to('company/branches');
}
示例8: update
public function update($id, Request $request)
{
$this->validate($request, $this->rules);
$product = $this->productRepo->update($id, $request->all());
session()->flash('message', trans('messages.update_success'));
return redirect()->back();
}
示例9: storeNode
/**
* store nestable node
*
* @param $class
* @param string|null $path
* @param integer|null $id
* @throws StoreException
* @return array
*/
protected function storeNode($class, $path = null, $id = null)
{
DB::beginTransaction();
try {
$datas = $this->request->parent != 0 || $this->request->related != 0 ? $this->getDefineDatas($class) : $this->request->all();
$this->model = $class::create($datas);
$this->model->setNode($class, $this->request);
// eğer başka ilişki varsa onları da ekle
if ($this->opsRelation && !$this->fillModel($this->opsRelation)) {
throw new StoreException($this->request->all());
}
event(new $this->events['success']($this->model));
DB::commit();
if (is_null($path)) {
$attribute = "{$this->name}_uc_first";
return response()->json(['id' => $this->model->id, 'name' => $this->model->{$attribute}]);
}
Flash::success(trans('laravel-modules-base::admin.flash.store_success'));
return $this->redirectRoute($path);
} catch (StoreException $e) {
DB::rollback();
event(new $this->events['fail']($e->getDatas()));
if (is_null($path)) {
return response()->json($this->returnData('error'));
}
Flash::error(trans('laravel-modules-base::admin.flash.store_error'));
return $this->redirectRoute($path);
}
}
示例10: extendWith
/**
* @param Menu $menu
*
* @return Menu
*/
public function extendWith(Menu $menu)
{
$menu->group(trans('core::sidebar.content'), function (Group $group) {
$group->item('Staff', function (Item $item) {
$item->icon('fa fa-copy');
$item->weight(10);
$item->authorize();
$item->item(trans('staff::departments.title.departments'), function (Item $item) {
$item->icon('fa fa-copy');
$item->weight(0);
$item->append('admin.staff.department.create');
$item->route('admin.staff.department.index');
$item->authorize($this->auth->hasAccess('staff.departments.index'));
});
$item->item(trans('staff::employees.title.employees'), function (Item $item) {
$item->icon('fa fa-copy');
$item->weight(0);
$item->append('admin.staff.employee.create');
$item->route('admin.staff.employee.index');
$item->authorize($this->auth->hasAccess('staff.employees.index'));
});
// append
});
});
return $menu;
}
示例11: buildupScript
/**
* Build tree grid scripts.
*
* @return void
*/
protected function buildupScript()
{
$confirm = trans('admin::lang.delete_confirm');
$token = csrf_token();
$this->script = <<<SCRIPT
\$('#{$this->elementId}').nestable({});
\$('._delete').click(function() {
var id = \$(this).data('id');
if(confirm("{$confirm}")) {
\$.post('/{$this->path}/' + id, {_method:'delete','_token':'{$token}'}, function(data){
\$.pjax.reload('#pjax-container');
});
}
});
\$('.{$this->elementId}-save').click(function () {
var serialize = \$('#{$this->elementId}').nestable('serialize');
\$.get('/{$this->path}', {'_tree':JSON.stringify(serialize)}, function(data){
\$.pjax.reload('#pjax-container');
});
});
\$('.{$this->elementId}-refresh').click(function () {
\$.pjax.reload('#pjax-container');
});
SCRIPT;
}
示例12: translated
/**
* Return the translated country name.
*
* @param null $locale
*
* @return null|string
*/
public function translated($locale = null)
{
if (!($key = $this->object->getValue())) {
return;
}
return trans('websemantics.field_type.country::country.' . $key, [], $locale);
}
示例13: nestedModelDisplayName
/**
* @return string Nested model display name.
*/
protected function nestedModelDisplayName()
{
if (!($nestedModelClassName = $this->nestedModelClassName())) {
return null;
}
return trans('restify.display_name.' . $nestedModelClassName);
}
示例14: getDeleteButtonAttribute
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-orders')) {
return '<a href="' . route('admin.order.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.delete') . '">' . trans('buttons.general.crud.delete') . '</i></a>';
}
return '';
}
示例15: processForm
protected function processForm($mode, $category_id, $id = null)
{
$input = array_filter(Input::all());
$rules = ['category_id' => 'required', 'title' => 'required|unique:categories', 'user_id' => 'required'];
if ($this->user_id == Input::get('user_id')) {
if ($id) {
$subcategory = Subcategories::find($id);
$messages = $this->validateCategory($input, $rules);
if ($messages->isEmpty()) {
$subcategory = $subcategory->update($input);
}
} else {
$messages = $this->validateCategory($input, $rules);
if ($messages->isEmpty()) {
$subcategory = $this->create($input);
$subcategory = Subcategory::create($input);
}
}
if ($messages->isEmpty()) {
return Redirect()->to('user/download/subcategories')->withSuccess(trans('validation.success'));
}
return Redirect()->back()->withInput()->withErrors($messages);
} else {
return Redirect()->back()->withInput()->withErrors(trans('validation.userid-problem'));
}
}