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


PHP Activity::create方法代码示例

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


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

示例1: attachTo

 public function attachTo(Request $request)
 {
     $this->validate($request, ['classroom_id' => 'required|exists:classrooms,id', 'quiz_id' => 'required|exists:quizzes,id'], ['required' => 'Kolom :attribute diperlukan']);
     $quiz = Quiz::findOrFail($request->quiz_id);
     Activity::create(['teacher_id' => $request->user()->id, 'classroom_id' => $request->classroom_id, 'action' => 'Membagikan quiz ke ', 'route' => 'classrooms.quizdetail', 'detail' => $quiz->id]);
     $quiz->classrooms()->sync([$request->classroom_id], false);
     \Flash::success('Quiz berhasil dibagikan.');
     return redirect()->back();
 }
开发者ID:alfrcr,项目名称:ilearn,代码行数:9,代码来源:QuizController.php

示例2: updateAssign

 public function updateAssign($id, $requestData)
 {
     $lead = Leads::findOrFail($id);
     $input = $requestData->get('fk_user_id_assign');
     $input = array_replace($requestData->all());
     $lead->fill($input)->save();
     $insertedName = $lead->assignee->name;
     $activityinput = array_merge(['text' => auth()->user()->name . ' assigned lead to ' . $insertedName, 'user_id' => Auth()->id(), 'type' => 'lead', 'type_id' => $id]);
     Activity::create($activityinput);
 }
开发者ID:Bottelet,项目名称:Flarepoint-crm,代码行数:10,代码来源:LeadRepository.php

示例3: attachTo

 public function attachTo(Request $request)
 {
     $this->validate($request, ['classroom_id' => 'required|exists:classrooms,id', 'assignment_id' => 'required|exists:assignments,id', 'deadline' => 'required'], ['required' => 'Kolom :attribute diperlukan']);
     $assignment = Assignment::findOrFail($request->assignment_id);
     Activity::create(['teacher_id' => $request->user()->id, 'classroom_id' => $request->classroom_id, 'action' => 'Membagikan tugas ke ', 'route' => 'classrooms.assignmentdetail', 'detail' => $assignment->id]);
     $start = Carbon::parse($request->start);
     $deadline = Carbon::parse($request->deadline);
     $assignment->classrooms()->sync([$request->classroom_id => ['start' => $start, 'deadline' => $deadline]], false);
     \Flash::success('Tugas berhasil dibagikan.');
     return redirect()->back();
 }
开发者ID:alfrcr,项目名称:ilearn,代码行数:11,代码来源:AssignmentController.php

示例4: updateAssign

 public function updateAssign($id, $requestData)
 {
     $task = Tasks::with('assignee')->findOrFail($id);
     $input = $requestData->get('fk_user_id_assign');
     $input = array_replace($requestData->all());
     $task->fill($input)->save();
     $task = $task->fresh();
     $insertedName = $task->assignee->name;
     $activityinput = array_merge(['text' => auth()->user()->name . ' assigned task to ' . $insertedName, 'user_id' => auth()->id(), 'type' => 'task', 'type_id' => $id]);
     Activity::create($activityinput);
 }
开发者ID:Bottelet,项目名称:Flarepoint-crm,代码行数:11,代码来源:TaskRepository.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $assoc_id = $request->input('assoc_id');
     $data = $request->except('_method', '_token', 'assoc_id');
     if ($act = Models\Activity::create($data)) {
         if ($act->assocs()->attach($assoc_id)) {
             return redirect(action('Admin\\ActivityController@index'));
         }
     } else {
         return redirect(action('Admin\\ActivityController@create'))->withInput()->withErrors('添加活动失败');
     }
 }
开发者ID:honxin,项目名称:studentclub,代码行数:18,代码来源:ActivityController.php

示例6: handle

 /**
  * Handle the event.
  *
  * @param  ClientAction  $event
  * @return void
  */
 public function handle(ClientAction $event)
 {
     $client = $event->getClient();
     switch ($event->getAction()) {
         case 'created':
             $text = Lang::get('misc.log.client.created', ['company' => $client->company_name, 'assignee' => $client->AssignedUser->name]);
             break;
         default:
             break;
     }
     $activityinput = array_merge(['text' => $text, 'user_id' => Auth()->id(), 'type' => Client::class, 'type_id' => $client->id, 'action' => $event->getAction()]);
     Activity::create($activityinput);
 }
开发者ID:bottelet,项目名称:flarepoint,代码行数:19,代码来源:ClientActionLog.php

示例7: handle

 /**
  * Handle the event.
  *
  * @param  TaskAction  $event
  * @return void
  */
 public function handle(TaskAction $event)
 {
     switch ($event->getAction()) {
         case 'created':
             $text = Lang::get('misc.log.task.created', ['title' => $event->getTask()->title, 'creator' => $event->getTask()->taskCreator->name, 'assignee' => $event->getTask()->assignee->name]);
             break;
         case 'updated_status':
             $text = Lang::get('misc.log.task.status', ['username' => Auth()->user()->name]);
             break;
         case 'updated_time':
             $text = Lang::get('misc.log.task.time', ['username' => Auth()->user()->name]);
             break;
         case 'updated_assign':
             $text = Lang::get('misc.log.task.assign', ['username' => Auth()->user()->name, 'assignee' => $event->getTask()->assignee->name]);
             break;
         default:
             break;
     }
     $activityinput = array_merge(['text' => $text, 'user_id' => Auth()->id(), 'type' => Tasks::class, 'type_id' => $event->getTask()->id, 'action' => $event->getAction()]);
     Activity::create($activityinput);
 }
开发者ID:bottelet,项目名称:flarepoint,代码行数:27,代码来源:TaskActionLog.php

示例8: handle

 /**
  * Handle the event.
  *
  * @param  LeadAction  $event
  * @return void
  */
 public function handle(LeadAction $event)
 {
     switch ($event->getAction()) {
         case 'created':
             $text = Lang::get('misc.log.lead.created', ['title' => $event->getLead()->title, 'creator' => $event->getLead()->createdBy->name, 'assignee' => $event->getLead()->assignee->name]);
             break;
         case 'updated_status':
             $text = Lang::get('misc.log.lead.status', ['username' => Auth()->user()->name]);
             break;
         case 'updated_deadline':
             $text = Lang::get('misc.log.lead.deadline', ['username' => Auth()->user()->name]);
             break;
         case 'updated_assign':
             $text = Lang::get('misc.log.lead.assign', ['username' => Auth()->user()->name, 'assignee' => $event->getLead()->assignee->name]);
             break;
         default:
             break;
     }
     $activityinput = array_merge(['text' => $text, 'user_id' => Auth()->id(), 'type' => Leads::class, 'type_id' => $event->getLead()->id, 'action' => $event->getAction()]);
     Activity::create($activityinput);
 }
开发者ID:bottelet,项目名称:flarepoint,代码行数:27,代码来源:LeadActionLog.php

示例9: addActivity

 /**
  * Create an Activity.
  *
  * @param  int  $uid
  * @param  string  $activityType
  * @param  int  $sourceId
  * @param  string  $sourceType
  * @param  int  $pid
  * @return void
  * @throws Exception
  */
 public function addActivity($uid, $activityType, $sourceId, $sourceType, $pid = NULL)
 {
     try {
         $activity = ['user_id' => $uid, 'activity_type' => $activityType, 'source_id' => $sourceId, 'source_type' => $sourceType, 'profile_id' => $pid];
         Activity::create($activity);
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:vinlore,项目名称:huddle,代码行数:20,代码来源:Controller.php


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