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


PHP Api::to方法代码示例

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


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

示例1: post

 public function post($user = false)
 {
     $title = Lang::get('core.email');
     if (is_array(Input::get('to')) && count(Input::get('to')) > 0) {
         $_results = false;
         foreach (Input::get('to') as $user_id) {
             $user = $this->user->find($user_id);
             if (!empty($user)) {
                 $_results = LCP::sendEmail($user, Input::get('template'));
             } else {
                 $_results = false;
             }
         }
         if ($_results == true) {
             $message = Lang::get('admin/users/messages.email.success');
             return Theme::make('admin/users/email_results', compact('title', 'message', '_results'));
         } else {
             $message = Lang::get('admin/users/messages.email.error');
             return Theme::make('admin/users/email_results', compact('title', 'message', '_results'));
         }
     } elseif (isset($user)) {
         if (LCP::sendEmail($user, Input::get('template'))) {
             return Api::to(array('success', Lang::get('admin/users/messages.email.success'))) ?: Redirect::to('admin/users/' . $user->id . '/email')->with('success', Lang::get('admin/users/messages.email.success'));
         } else {
             return Api::to(array('error', Lang::get('admin/users/messages.email.error'))) ?: Redirect::to('admin/users/' . $user->id . '/email')->with('error', Lang::get('admin/users/messages.email.error'));
         }
     } else {
         $message = Lang::get('admin/users/messages.email.error');
         Theme::make('admin/users/email_results', compact('title', 'message'));
     }
 }
开发者ID:Aranjedeath,项目名称:Laravel_Starter,代码行数:31,代码来源:EmailService.php

示例2: edit

 public function edit($post)
 {
     $validator = Validator::make(Input::all(), $this->rules);
     if ($validator->passes()) {
         return $this->post->createOrUpdate($post->id) ? Api::to(array('success', Lang::get('admin/blogs/messages.update.success'))) ?: Redirect::to('admin/slugs/' . $post->id . '/edit')->with('success', Lang::get('admin/blogs/messages.update.success')) : Api::to(array('error', Lang::get('admin/blogs/messages.update.error'))) ?: Redirect::to('admin/slugs/' . $post->id . '/edit')->with('error', Lang::get('admin/blogs/messages.update.error'));
     } else {
         return Api::to(array('error', Lang::get('admin/blogs/messages.update.error'))) ?: Redirect::to('admin/slugs/' . $post->id . '/edit')->withInput()->withErrors($validator);
     }
 }
开发者ID:Aranjedeath,项目名称:Laravel_Starter,代码行数:9,代码来源:BlogService.php

示例3: edit

 public function edit($role)
 {
     if (in_array(Input::old('name', $role->name), \Role::$protected) && Input::old('name', $role->name) != Input::get('name') || in_array(Input::get('name'), \Role::$protected) && Input::old('name', $role->name) != Input::get('name')) {
         return Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('error', Lang::get('admin/roles/messages.update.error'));
     }
     $inputs = Input::except('csrf_token');
     $save = $this->role->createOrUpdate($role->id, $this->permission->preparePermissionsForSave($inputs['permissions']));
     $errors = $save->errors();
     return count($errors->all()) == 0 ? Api::to(array('success', Lang::get('admin/roles/messages.update.success'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('success', Lang::get('admin/roles/messages.update.success')) : (Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->withErrors($errors));
 }
开发者ID:Askedio,项目名称:LaravelCP-v1,代码行数:10,代码来源:RoleService.php

示例4: edit

 public function edit($comment)
 {
     $rules = array('content' => 'required|min:3');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         return $this->comment->createOrUpdate($comment->id) ? Api::to(array('success', Lang::get('admin/comments/messages.update.success'))) ?: Redirect::to('admin/comments/' . $comment->id . '/edit')->with('success', Lang::get('admin/comments/messages.update.success')) : Api::to(array('error', Lang::get('admin/comments/messages.update.error'))) ?: Redirect::to('admin/comments/' . $comment->id . '/edit')->with('error', Lang::get('admin/comments/messages.update.error'));
     } else {
         return Api::to(array('error', Lang::get('admin/comments/messages.update.error'))) ?: Redirect::to('admin/comments/' . $comment->id . '/edit')->withInput()->withErrors($validator);
     }
 }
开发者ID:Aranjedeath,项目名称:Laravel_Starter,代码行数:10,代码来源:CommentService.php

示例5: post

 public function post()
 {
     $settings = Input::get('settings');
     if (isset($settings) && is_array($settings)) {
         foreach ($settings as $var => $val) {
             Setting::set($var, $val);
         }
         Setting::save();
     }
     return Api::to(array('success', Lang::get('admin/settings/messages.update.success'))) ?: Redirect::to('admin/settings')->with('success', Lang::get('admin/settings/messages.update.success'));
 }
开发者ID:Askedio,项目名称:LaravelCP-v1,代码行数:11,代码来源:SettingService.php

示例6: edit

 public function edit($role)
 {
     if (in_array(Input::old('name', $role->name), $this->protected_roles) && Input::old('name', $role->name) != Input::get('name') || in_array(Input::get('name'), $this->protected_roles) && Input::old('name', $role->name) != Input::get('name')) {
         return Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('error', Lang::get('admin/roles/messages.update.error'));
     }
     $validator = Validator::make(Input::all(), $this->rules);
     if ($validator->passes()) {
         $inputs = Input::except('csrf_token');
         return $this->role->createOrUpdate($role->id, $this->permission->preparePermissionsForSave($inputs['permissions'])) ? Api::to(array('success', Lang::get('admin/roles/messages.update.success'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('success', Lang::get('admin/roles/messages.update.success')) : Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('error', Lang::get('admin/roles/messages.update.error'));
     }
     return Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->withInput()->withErrors($validator);
 }
开发者ID:Aranjedeath,项目名称:Laravel_Starter,代码行数:12,代码来源:RoleService.php

示例7: putEdit

 /**
  * put edit
  *
  * @return Response
  */
 public function putEdit($todo)
 {
     $rules = array('title' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $todo->title = Input::get('title');
         $todo->description = Input::get('description');
         $todo->status = Input::get('status');
         $todo->due_at = Carbon::parse(Input::get('due_at'));
         return $todo->save() ? Api::to(array('success', Lang::get('admin/todos/messages.create.success'))) ?: Redirect::to('admin/todos/' . $todo->id . '/edit')->with('success', Lang::get('admin/todos/messages.create.success')) : Api::to(array('error', Lang::get('admin/todos/messages.create.error'))) ?: Redirect::to('admin/todos/' . $todo->id . '/edit')->with('error', Lang::get('admin/todos/messages.create.error'));
     } else {
         return Api::to(array('error', Lang::get('admin/todos/messages.create.error'))) ?: Redirect::to('admin/todos/' . $todo->id . '/edit')->withErrors($validator);
     }
 }
开发者ID:Aranjedeath,项目名称:l4-starter,代码行数:19,代码来源:AdminTodosController.php

示例8: putEdit

 /**
  * Update the specified resource in storage.
  *
  * @param $comment
  * @return Response
  */
 public function putEdit($comment)
 {
     $rules = array('content' => 'required|min:3');
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         $comment->content = Input::get('content');
         if ($comment->save()) {
             return Api::to(array('success', Lang::get('admin/comments/messages.update.success'))) ?: Redirect::to('admin/comments/' . $comment->id . '/edit')->with('success', Lang::get('admin/comments/messages.update.success'));
         } else {
             return Api::to(array('error', Lang::get('admin/comments/messages.update.error'))) ?: Redirect::to('admin/comments/' . $comment->id . '/edit')->with('error', Lang::get('admin/comments/messages.update.error'));
         }
     } else {
         return Api::to(array('error', Lang::get('admin/comments/messages.update.error'))) ?: Redirect::to('admin/comments/' . $comment->id . '/edit')->withInput()->withErrors($validator);
     }
 }
开发者ID:Aranjedeath,项目名称:l4-starter,代码行数:22,代码来源:AdminCommentsController.php

示例9: postIndex

 /**
  * Update the specified resource in storage.
  *
  * @param $comment
  * @return Response
  */
 public function postIndex()
 {
     $rules = array();
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $settings = Input::get('settings');
         if (isset($settings) && is_array($settings)) {
             foreach ($settings as $var => $val) {
                 Setting::set($var, $val);
             }
             Setting::save();
         }
         return Api::to(array('success', Lang::get('admin/settings/messages.update.success'))) ?: Redirect::to('admin/settings')->with('success', Lang::get('admin/settings/messages.update.success'));
     } else {
         return Api::to(array('error', Lang::get('admin/settings/messages.update.error'))) ?: Redirect::to('admin/settings')->withInput()->withErrors($validator);
     }
 }
开发者ID:Aranjedeath,项目名称:l4-starter,代码行数:23,代码来源:AdminSettingsController.php

示例10: putEdit

 /**
  * Update the specified resource in storage.
  *
  * @param $post
  * @return Response
  */
 public function putEdit($statuses)
 {
     $rules = array('title' => 'required|min:3');
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         if ((int) Input::get('close_status') == 1) {
             TicketStatuses::where('close_status', '=', '1')->update(array('close_status' => '0'));
         }
         if ((int) Input::get('default_flag') == 1) {
             TicketStatuses::where('default_flag', '=', '1')->update(array('default_flag' => '0'));
         }
         if ((int) Input::get('default_button') == 1) {
             TicketStatuses::where('default_button', '=', '1')->update(array('default_button' => '0'));
         }
         if ((int) Input::get('default_category') == 1) {
             TicketStatuses::where('default_category', '=', '1')->update(array('default_category' => '0'));
         }
         $statuses->title = Input::get('title');
         $statuses->color = Input::get('color');
         $statuses->sort = (int) Input::get('sort');
         $statuses->show_active = (int) Input::get('show_active');
         $statuses->default_flag = (int) Input::get('default_flag');
         $statuses->default_button = (int) Input::get('default_button');
         $statuses->default_category = (int) Input::get('default_category');
         $statuses->auto_close = (int) Input::get('auto_close');
         $statuses->close_status = (int) Input::get('close_status');
         return $statuses->save() ? Api::to(array('success', Lang::get('l4cp-support::messages.update.success'))) ?: Redirect::to('admin/support/statuses/' . $statuses->id . '/edit')->with('success', Lang::get('l4cp-support::messages.update.success')) : Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/statuses/' . $statuses->id . '/edit')->with('error', Lang::get('l4cp-support::messages.update.error'));
     } else {
         return Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/statuses/' . $statuses->id . '/edit')->withInput()->withErrors($validator);
     }
 }
开发者ID:Askedio,项目名称:l4cp-support,代码行数:38,代码来源:SupportStatusesController.php

示例11: putEdit

 /**
  * Update the specified resource in storage.
  *
  * @param $post
  * @return Response
  */
 public function putEdit($spam)
 {
     $rules = array('type' => 'required', 'content' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         $spam->type = Input::get('type');
         $spam->content = Input::get('content');
         return $spam->save() ? Api::to(array('success', Lang::get('l4cp-support::messages.update.success'))) ?: Redirect::to('admin/support/spam/' . $spam->id . '/edit')->with('success', Lang::get('l4cp-support::messages.update.success')) : Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/spam/' . $spam->id . '/edit')->with('error', Lang::get('l4cp-support::messages.update.error'));
     } else {
         return Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/spam/' . $spam->id . '/edit')->withInput()->withErrors($validator);
     }
 }
开发者ID:Askedio,项目名称:l4cp-support,代码行数:19,代码来源:SupportSpamfilterController.php

示例12: edit

 public function edit($comment)
 {
     $save = $this->comment->createOrUpdate($comment->id);
     $errors = $save->errors();
     return count($errors->all()) == 0 ? Api::to(array('success', Lang::get('admin/comments/messages.update.success'))) ?: Redirect::to('admin/comments/' . $comment->id . '/edit')->with('success', Lang::get('admin/comments/messages.update.success')) : (Api::to(array('error', Lang::get('admin/comments/messages.update.error'))) ?: Redirect::to('admin/comments/' . $comment->id . '/edit')->withErrors($errors));
 }
开发者ID:Askedio,项目名称:LaravelCP-v1,代码行数:6,代码来源:CommentService.php

示例13: putEdit

 /**
  * Update the specified resource in storage.
  *
  * @param $post
  * @return Response
  */
 public function putEdit($department)
 {
     $rules = array('name' => 'required|min:3', 'flags' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         $department->name = Input::get('name');
         $department->description = Input::get('description');
         $department->email = Input::get('email');
         $department->pop_host = Input::get('pop_host');
         $department->pop_port = Input::get('pop_port');
         $department->pop_user = Input::get('pop_user');
         $department->pop_pass = Input::get('pop_pass');
         $department->clients_only = (int) Input::get('clients_only');
         $department->auto_respond = (int) Input::get('auto_respond');
         $department->hidden = (int) Input::get('hidden');
         $department->sort = (int) Input::get('sort');
         $department->saveFlags(Input::get('flags'));
         return $department->save() ? Api::to(array('success', Lang::get('l4cp-support::messages.update.success'))) ?: Redirect::to('admin/support/departments/' . $department->id . '/edit')->with('success', Lang::get('l4cp-support::messages.update.success')) : Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/departments/' . $department->id . '/edit')->with('error', Lang::get('l4cp-support::messages.update.error'));
     } else {
         return Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/departments/' . $department->id . '/edit')->withInput()->withErrors($validator);
     }
 }
开发者ID:Askedio,项目名称:l4cp-support,代码行数:29,代码来源:SupportDepartmentController.php

示例14: putEdit

 /**
  * Update the specified resource in storage.
  *
  * @param $post
  * @return Response
  */
 public function putEdit($escalations)
 {
     $rules = array('name' => 'required|min:3');
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         $escalations->name = Input::get('name');
         $escalations->delay = (int) Input::get('delay');
         $escalations->reply = Input::get('reply');
         $escalations->notify_admins = (int) Input::get('notify_admins');
         $escalations->flag = (int) Input::get('flag');
         $escalations->priority = json_encode(Input::get('priorities'));
         $escalations->new_status = (int) Input::get('new_status');
         $escalations->new_priority = (int) Input::get('new_priority');
         $escalations->new_department = (int) Input::get('new_department');
         $escalations->saveDeps(Input::get('departments'));
         $escalations->saveStatuses(Input::get('statuses'));
         $escalations->saveFlags(explode(',', Input::get('flags')));
         return $escalations->save() ? Api::to(array('success', Lang::get('l4cp-support::messages.update.success'))) ?: Redirect::to('admin/support/escalations/' . $escalations->id . '/edit')->with('success', Lang::get('l4cp-support::messages.update.success')) : Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/escalations/' . $escalations->id . '/edit')->with('error', Lang::get('l4cp-support::messages.update.error'));
     } else {
         return Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/escalations/' . $escalations->id . '/edit')->withInput()->withErrors($validator);
     }
 }
开发者ID:Askedio,项目名称:l4cp-support,代码行数:29,代码来源:SupportEscalationsController.php

示例15: putEdit

 /**
  * Update the specified resource in storage.
  *
  * @param $post
  * @return Response
  */
 public function putEdit($tickets)
 {
     $rules = array('title' => 'required|min:3');
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         $tickets->user_id = Input::get('user_id');
         //$tickets->admin_id = Confide::user()->id;
         $tickets->department_id = Input::get('department_id');
         $tickets->name = Input::get('name');
         $tickets->email = Input::get('email');
         $tickets->title = Input::get('title');
         $tickets->attachment = Input::get('attachment');
         $tickets->message = Input::get('content');
         $tickets->priority = Input::get('priority');
         $tickets->status = Input::get('status');
         $tickets->saveFlags(explode(',', Input::get('flags')));
         foreach (Input::get('notes') as $id => $note) {
             $not = TicketNotes::find($id);
             if (!empty($not)) {
                 if (trim($note) != '') {
                     $not->fill(array('id' => $id, 'content' => $note))->push();
                 } else {
                     $not->delete();
                 }
             } else {
                 $not = new TicketNotes(array('id' => $id, 'content' => $note, 'admin_id' => Confide::user()->id));
                 $tickets->notes()->save($not);
             }
         }
         Support::Trigger('edit', $tickets);
         return $tickets->save() ? Api::to(array('success', Lang::get('l4cp-support::messages.update.success'))) ?: Redirect::to('admin/support/' . $tickets->id . '/edit')->with('success', Lang::get('l4cp-support::messages.update.success')) : Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/' . $tickets->id . '/edit')->with('error', Lang::get('l4cp-support::messages.update.error'));
     } else {
         return Api::to(array('error', Lang::get('l4cp-support::messages.update.error'))) ?: Redirect::to('admin/support/' . $tickets->id . '/edit')->withInput()->withErrors($validator);
     }
 }
开发者ID:Askedio,项目名称:l4cp-support,代码行数:42,代码来源:SupportController.php


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