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')); }
/** * 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; }
/** * 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')); }
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; }
/** * @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; }
/** * 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); }); }
public function archive($publicId) { $branch = Branch::scope($publicId)->firstOrFail(); $branch->delete(); Session::flash('message', trans('texts.archived_branch')); return Redirect::to('company/branches'); }
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(); }
/** * 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); } }
/** * @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; }
/** * 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; }
/** * 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); }
/** * @return string Nested model display name. */ protected function nestedModelDisplayName() { if (!($nestedModelClassName = $this->nestedModelClassName())) { return null; } return trans('restify.display_name.' . $nestedModelClassName); }
/** * @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 ''; }
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')); } }
public function destroy($id) { $user = $this->model->findOrFail($id); $this->userRepository->deleteUser($user); flash()->success(trans('LaravelAdmin::laravel-admin.userDeleted')); return Redirect::back(); }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('nickname')->unique(); $table->string('email')->unique(); $table->string('password', 60); $table->string('pic_url')->nullable(); $table->string('language')->default('en'); $table->string('mobile_phone')->nullable(); $table->string('work_phone')->nullable(); $table->string('website')->nullable(); $table->string('twitter')->nullable(); $table->string('facebook')->nullable(); $table->string('description')->nullable(); $table->string('time_zone')->nullable(); $table->integer('rate_val')->nullable(); $table->integer('rate_count')->nullable(); $table->enum('role', array_keys(trans('globals.roles')))->default('person'); $table->enum('type', array_keys(trans('globals.type_user')))->default('normal'); $table->enum('verified', array_keys(trans('globals.verification')))->default('no'); $table->json('preferences')->nullable(); $table->rememberToken(); $table->timestamps(); $table->timestamp('disabled_at')->nullable(); $table->softDeletes(); }); }
/** * Execute the console command. * * @param ExtensionManager $manager * @param ExtensionCollection $extensions */ public function fire(ExtensionManager $manager, ExtensionCollection $extensions) { /* @var Extension $extension */ $extension = $extensions->get($this->argument('extension')); $manager->install($extension, $this->option('seed')); $this->info(trans($extension->getName()) . ' installed successfully!'); }
function day_localize($day, $is = "en", $localize = "tr") { $localize = \App::getLocale(); $days['locale']['D'] = [trans('whole::http/helpers.monday'), trans('whole::http/helpers.tuesday'), trans('whole::http/helpers.wednesday'), trans('whole::http/helpers.thursday'), trans('whole::http/helpers.friday'), trans('whole::http/helpers.saturday'), trans('whole::http/helpers.sunday')]; $days['en']['D'] = ['Monday ', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; return $days['locale']['D'][array_search($day, $days[$is]['D'])]; }
/** * Performs the event. */ public function fire() { $this->info(trans('slackin.updating_status')); $status = $this->slack->refreshUsersStatus(); $this->infoStatusUser($status); $this->info(trans('slackin.command_done')); }
public function archive($publicId) { $product = Product::scope($publicId)->firstOrFail(); $product->delete(); Session::flash('message', trans('texts.archived_product')); return Redirect::to('company/products'); }
public function index() { $this->indexPage(['tableHead' => [trans('app.id') => 'id', trans('app.title') => 'title'], 'tableRow' => function ($tournament) { Hover::modelAttributes($tournament, ['icon', 'creator']); return [$tournament->id, raw(Hover::pull(), $tournament->title)]; }]); }
/** * @return \Response */ public function update() { $this->passwordForm->validate(Input::all()); $this->user()->password = Input::get('new_password'); $this->user()->save(); return json(trans('app.password_changed')); }
/** * Updates a component with the entered info. * * @param \CachetHQ\Cachet\Models\Component $component * * @throws \Exception * * @return \CachetHQ\Cachet\Models\Component */ public function postUpdateComponent(Component $component) { if (!$component->update(Binput::except(['_token']))) { throw new Exception(trans('dashboard.components.edit.failure')); } return $component; }
public function store() { $data = Input::all(); $error = false; if (isset($data['invoice_id'])) { $invoice = Invoice::scope($data['invoice_id'])->with('client')->first(); if ($invoice) { $data['invoice'] = $invoice->public_id; $data['client'] = $invoice->client->public_id; } else { $error = trans('validation.not_in', ['attribute' => 'invoice_id']); } } else { $error = trans('validation.not_in', ['attribute' => 'invoice_id']); } if (!isset($data['transaction_reference'])) { $data['transaction_reference'] = ''; } if (!$error) { $payment = $this->paymentRepo->save($data); $payment = Payment::scope($payment->public_id)->with('client', 'contact', 'user', 'invoice')->first(); $payment = Utils::remapPublicIds([$payment]); } $response = json_encode($error ?: $payment, JSON_PRETTY_PRINT); $headers = Utils::getApiHeaders(); return Response::make($response, 200, $headers); }
public function index() { $this->indexPage(['buttons' => ['new', 'category'], 'tableHead' => [trans('app.id') => 'id', trans('app.title') => 'title', trans('app.category') => 'downloadcat_id'], 'tableRow' => function ($download) { Hover::modelAttributes($download, ['access_counter', 'creator']); return [$download->id, raw(Hover::pull() . HTML::link('downloads/' . $download->id . '/' . $download->slug, $download->title)), $download->downloadcat->title]; }]); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle($request, Closure $next) { if ($this->auth->check() && $this->auth->user()->isRestricted()) { return error_popup(trans('errors.no_restricted_access')); } return $next($request); }
/** * @param null $message * @param int $code * @param Exception $previous */ public function __construct($message = null, $code = 0, \Exception $previous = null) { if ($message === null) { $message = trans($this->message); } parent::__construct($message, $code, $previous); }
protected function sendMailTo($user, $data) { $subject = trans('fluxbb::register.mail_welcome_subject', [':board' => $this->config->get('o_board_title')]); $this->mailer->plain('fluxbb:mail::welcome', $data, function ($mail) use($user, $subject) { $mail->to($user->email)->subject($subject); }); }
/** * Handle the command. */ public function handle(MessageBag $messages, Translator $translator) { // If we can't save or there are errors then skip it. if ($this->builder->hasFormErrors() || !$this->builder->canSave()) { return; } // If there is no model and there isn't anything specific to say, skip it. if (!$this->builder->getFormEntry() && !$this->builder->getFormOption('success_message')) { return; } $mode = $this->builder->getFormMode(); // False means no message is desired. if ($this->builder->getFormOption('success_message') === false) { return; } $entry = $this->builder->getFormEntry(); $stream = $this->builder->getFormStream(); $parameters = ['title' => is_object($entry) ? $entry->getTitle() : null, 'name' => is_object($stream) ? $stream->getName() : null]; // If the name doesn't exist we need to be clever. if (str_contains($parameters['name'], '::') && !$translator->has($parameters['name']) && $stream) { $parameters['name'] = ucfirst(str_singular(str_replace('_', ' ', $stream->getSlug()))); } elseif ($parameters['name']) { $parameters['name'] = str_singular(trans($parameters['name'])); } else { $parameters['name'] = trans('streams::entry.name'); } /** * Set the default success message. */ if ($this->builder->getFormOption('success_message') === null) { $this->builder->setFormOption('success_message', trans('streams::message.' . $mode . '_success', $parameters)); } $messages->{$this->builder->getFormOption('success_message_type', 'success')}($this->builder->getFormOption('success_message')); }