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


PHP EmailTemplate::findOrFail方法代码示例

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


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

示例1: update

 /**
  * Update the specified emailtemplate in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $emailtemplate = EmailTemplate::findOrFail($id);
     $validator = Validator::make($data = Input::all(), EmailTemplate::rules($id));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $emailtemplate->update($data);
     return Redirect::route('admin.templates.index')->with("message", "Data berhasil disimpan");
 }
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:16,代码来源:EmailTemplatesController.php

示例2: post_emailtemplateedit

 public function post_emailtemplateedit($id)
 {
     //Verify we are editing our own template (unless we our access level is > 0)
     if (Auth::consoleuser()->get()->access < 1) {
         $check = EmailTemplate::where('id', '=', $id)->where('author', '=', Auth::consoleuser()->get()->cid)->count();
         if ($check < 1) {
             return Redirect::route('consoleemailtemplates')->with('error', 'Unauthorized template edit');
         }
     }
     //Pull our fields
     $name = Input::get('inputName');
     $subject = Input::get('inputSubject');
     $content = Input::get('inputContent');
     $public = Input::get('inputPublic');
     if (empty($name) || empty($subject) || empty($content)) {
         return Redirect::to('console/emailtemplates/edit/' . $id)->with('error', 'Please complete all of the required fields.');
     }
     if ($public != 1) {
         $public = 0;
     }
     //All clear let's update the db
     $template = EmailTemplate::findOrFail($id);
     $template->name = $name;
     $template->subject = $subject;
     $template->content = $content;
     $template->public = $public;
     $template->save();
     return Redirect::route('consoleemailtemplates')->with('message', 'Template Updated.');
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:29,代码来源:ConsoleController.php

示例3: postEditEmailTemplate

 public function postEditEmailTemplate()
 {
     if (!Input::has('id')) {
         return Redirect::route(self::EmailHome);
     }
     $input = Input::all();
     try {
         $tpl = EmailTemplate::findOrFail($input['id']);
         $tpl->fill($input);
         $this->flash($tpl->save());
         return Redirect::route(self::EmailHome);
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         App::abort(404);
     }
 }
开发者ID:guilhermefilippo,项目名称:access-manager,代码行数:15,代码来源:TemplatesController.php


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