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


PHP Activity::save方法代码示例

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


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

示例1: testActivityCanBeAddedToAnEvent1

 public function testActivityCanBeAddedToAnEvent1()
 {
     $this->logIn();
     $event = new Event();
     $event->name = 'Kokous';
     $event->time = '2016-07-25 16:40:00';
     $event->place = 'Kolo';
     $event->description = 'Iltakokous';
     $event->endDate = '2016-07-25 17:20:20';
     $event->group_id = self::createTestGroup();
     $event->save();
     $activity = new Activity();
     $activity->name = 'Kalastus';
     $activity->guid = 'Guid';
     $activity->age_group = 'sudenpennut';
     $activity->task_group = 'pohjoinen';
     $activity->save();
     $event_id = DB::table('events')->where('name', 'Kokous')->value('id');
     // Pitää muutta occurensejä käyttämään
     /* $this->visit('/events/'. $event_id)
        ->click('Muuta aktiviteetteja')
        ->see('Äänestys')
        ->press('Lisää')
        ->click('Takaisin')
        ->see('Äänestys'); */
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:26,代码来源:ActivityViewTest.php

示例2: processForm

 public function processForm(Request $request)
 {
     $this->validate($request, ['date' => 'required|date']);
     $car_id = $request->input('car');
     $date = $request->input('date');
     $type = $request->input('type');
     $activity = new Activity();
     $carbon_date = Carbon\Carbon::createFromFormat('m/d/Y', $date);
     // dd($carbon_date->format('Y-m-d'));
     $activity->date = $carbon_date->format('Y-m-d');
     $activity->car_id = $car_id;
     $activity->save();
     $activities = Activity::orderBy('created_at', 'desc')->take(10)->get();
     Session::put('activity', $activity);
     if ($type == '1') {
         return redirect()->route('process.ondayForm');
     } else {
         if ($type == '2') {
             return redirect()->route('process.maintenanceForm');
             //  return view('home', [ 'type'=> '2', 'activity' => $activity, 'activities' => $activities]);
         } else {
             if ($type == '3') {
                 //nil
                 return redirect()->route('process.nilForm');
             } else {
                 //error
             }
         }
     }
 }
开发者ID:jubaedprince,项目名称:rkt,代码行数:30,代码来源:HomeController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $notify_report = false;
     for ($i = 0; $i < count($request->all()); $i++) {
         if ($request->input($i . '.include')) {
             $this->validate($request, [$i . '.id' => 'required', $i . '.member.id' => 'required|numeric', $i . '.position_id' => 'required|numeric', $i . '.project_id' => 'required|numeric', $i . '.target_id' => 'required|numeric', $i . '.output' => 'required|numeric', $i . '.date_start' => 'required|date', $i . '.date_end' => 'required|date', $i . '.hours_worked' => 'required|numeric', $i . '.daily_work_hours' => 'required|numeric', $i . '.output_error' => 'required|numeric']);
             // check if a report is already created
             if (!$notify_report) {
                 $admin = User::where('role', 'admin')->first();
                 $report = Report::where('id', $request->input($i . '.report_id'))->first();
                 // create a notification
                 $notification = new Notification();
                 $notification->message = 'updated a ';
                 $notification->sender_user_id = $request->user()->id;
                 $notification->receiver_user_id = $admin->id;
                 $notification->subscriber = 'admin';
                 $notification->state = 'main.weekly-report';
                 $notification->event_id = $report->id;
                 $notification->event_id_type = 'report_id';
                 $notification->seen = false;
                 $notification->save();
                 $notify = DB::table('reports')->join('users', 'users.id', '=', 'reports.user_id')->join('projects', 'projects.id', '=', 'reports.project_id')->join('notifications', 'notifications.event_id', '=', 'reports.id')->select('reports.*', 'users.*', DB::raw('LEFT(users.first_name, 1) as first_letter'), 'projects.*', 'notifications.*')->where('notifications.id', $notification->id)->first();
                 // foreach ($query as $key => $value) {
                 //     $notify = $value;
                 // }
                 event(new ReportSubmittedBroadCast($notify));
                 $activity_type = ActivityType::where('action', 'update')->first();
                 $activity = new Activity();
                 $activity->report_id = $report->id;
                 $activity->user_id = $request->user()->id;
                 $activity->activity_type_id = $activity_type->id;
                 $activity->save();
                 // report
                 $create_report = true;
             }
             $old_performance = Performance::where('id', $request->input($i . '.id'))->first();
             // record history of the performance
             $performance_history = new PerformanceHistory();
             $performance_history->activity_id = $activity->id;
             $performance_history->performance_id = $old_performance->id;
             $performance_history->report_id = $old_performance->report_id;
             $performance_history->member_id = $old_performance->member_id;
             $performance_history->position_id = $old_performance->position_id;
             $performance_history->department_id = $old_performance->department_id;
             $performance_history->project_id = $old_performance->project_id;
             $performance_history->target_id = $old_performance->target_id;
             $performance_history->date_start = $old_performance->date_start;
             $performance_history->date_end = $old_performance->date_end;
             $performance_history->daily_work_hours = $old_performance->daily_work_hours;
             $performance_history->output = $old_performance->output;
             $performance_history->hours_worked = $old_performance->hours_worked;
             $performance_history->output_error = $old_performance->output_error;
             $performance_history->average_output = $old_performance->average_output;
             $performance_history->productivity = $old_performance->productivity;
             $performance_history->quality = $old_performance->quality;
             $performance_history->quadrant = $old_performance->quadrant;
             $performance_history->save();
         }
     }
 }
开发者ID:mcoyevans,项目名称:personiv-productivity-quality-report,代码行数:66,代码来源:PerformanceHistoryController.php

示例4: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     Task::created(function ($task) {
         $activity = new Activity();
         $activity->user_id = Auth::user()->id;
         $activity->task_id = $task->id;
         $activity->message = 'task created';
         $activity->save();
     });
 }
开发者ID:cclass,项目名称:taskboard,代码行数:15,代码来源:ActivityServiceProvider.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $item = new Activity();
     $item->status = "active";
     $item->name = $request->input("name");
     $item->code = $request->input("code");
     $item->save();
     Log::create(array("user_id" => Auth::user()->id, "action" => "Add Activities named " . $item->name));
     return $item;
 }
开发者ID:kelvinmbwilo,项目名称:VVS,代码行数:16,代码来源:ActivitiesController.php

示例6: pullDataForProvider

 private static function pullDataForProvider($provider)
 {
     foreach ($provider->providesSensors() as $name => $type) {
         $functionName = self::getFunctionName($name, $type);
         $val = $provider->{$functionName}();
         $activity = new Activity();
         $activity->provider = get_class($provider);
         $activity->name = $name;
         $activity->value = $val;
         $activity->save();
     }
 }
开发者ID:hjem,项目名称:hjem,代码行数:12,代码来源:ProviderManager.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\ActivityCreateRequest $request)
 {
     $data = $request->all();
     $validator = Validator::make($request->all(), $request->rules(), $request->messages());
     if ($validator->valid()) {
         $activity = new Activity();
         $activity->name = $data['name'];
         $activity->name_small = $data['name_small'];
         $activity->save();
         $act = Activity::find($activity->id);
         return response()->json(['valid' => true, 'act' => $act], 200);
     }
 }
开发者ID:JohanArmando,项目名称:ProyectoGrado,代码行数:19,代码来源:ActivityController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $v = Validator::make(Request::all(), ['activity' => 'required|max:50|unique:activities', 'desc' => 'required|max:100']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $activity = new Activity();
         $activity->activity = Request::get('activity');
         $activity->desc = Request::get('desc');
         $activity->save();
         return redirect('activities');
     }
 }
开发者ID:raniafathy,项目名称:wavexpo,代码行数:19,代码来源:ActivitiesController.php

示例9: testActivityIsAddedToUserCorrectly

 public function testActivityIsAddedToUserCorrectly()
 {
     $this->logIn();
     $user = new User();
     $user->membernumber = '100000';
     $user->firstname = 'First_name';
     $user->lastname = 'Last_name';
     $user->save();
     $activity = new Activity();
     $activity->guid = 1;
     $activity->name = 'Activity 1';
     $activity->age_group = 'sudenpennut';
     $activity->task_group = 'pohjoinen';
     $activity->save();
     $this->visit('/users/1/activities')->select('1', 'activityId')->press('Lisää')->seeInDatabase('activity_user', ['activity_id' => 1, 'user_id' => 1]);
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:16,代码来源:NewUserActivityViewTest.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required|unique:pages|max:255', 'starttime' => 'required', 'endtime' => 'required', 'place' => 'required', 'organizer' => 'required', 'tel' => 'required', 'requirement' => 'max:255']);
     $activity = new Activity();
     $activity->title = Input::get('title');
     $activity->starttime = Input::get('starttime');
     $activity->endtime = Input::get('endtime');
     $activity->place = Input::get('place');
     $activity->organizer = Input::get('organizer');
     $activity->tel = Input::get('tel');
     $activity->email = Input::get('email');
     $activity->requirement = Input::get('requirement');
     $activity->detail = Input::get('detail');
     //$activity->user_id = 1;//Auth::user()->id;
     if ($activity->save()) {
         return Redirect::to('activity');
     } else {
         return Redirect::back()->withInput()->withErrors('保存失败!');
     }
 }
开发者ID:RetinaInc,项目名称:BNUSPORTS,代码行数:25,代码来源:ActivityController.php

示例11: reportDelete

 public function reportDelete(Request $request, $id)
 {
     $activity_type = ActivityType::where('action', 'delete')->first();
     $activity = new Activity();
     $activity->report_id = $id;
     $activity->user_id = $request->user()->id;
     $activity->activity_type_id = $activity_type->id;
     $activity->save();
     $admin = User::where('email', 'sherryl.sanchez@personiv.com')->first();
     $notification = new Notification();
     $notification->receiver_user_id = $admin->id;
     $notification->sender_user_id = $request->user()->id;
     $notification->subscriber = 'admin';
     $notification->message = 'deletes ';
     $notification->state = 'main.activity';
     $notification->event_id = $id;
     $notification->event_id_type = 'report_id';
     $notification->seen = false;
     $notification->save();
     $notify = DB::table('reports')->join('users', 'users.id', '=', 'reports.user_id')->join('projects', 'projects.id', '=', 'reports.project_id')->join('notifications', 'notifications.event_id', '=', 'reports.id')->select('reports.*', 'users.*', DB::raw('LEFT(users.first_name, 1) as first_letter'), 'projects.*', 'notifications.*')->where('notifications.id', $notification->id)->first();
     event(new ReportSubmittedBroadCast($notify));
 }
开发者ID:mcoyevans,项目名称:personiv-productivity-quality-report,代码行数:22,代码来源:ApprovalController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     if ($request->input('plant_id') == null) {
         return response()->json("invalid", "500");
     }
     $user = User::where('username', '=', $request->input('username'))->first();
     $activity = new Activity();
     $activity->description = $request->input('description');
     $activity->date = date("Y-m-d", strtotime($request->input('date')));
     $activity->time = $request->input('time');
     $activity->weather = $request->input('weather');
     $activity->plant_id = $request->input('plant_id');
     $typeActivity[] = $request->input('type');
     $activity->save();
     foreach ($typeActivity as $id) {
         if ($id != "0") {
             $activity->activityType()->attach($id);
         }
     }
     if ($user != null) {
         $activity->user()->attach($user->id);
     }
     return $activity;
 }
开发者ID:bossgame1234,项目名称:MS4SF,代码行数:30,代码来源:activityController.php

示例13: recordActivity

 public function recordActivity($event)
 {
     $model = strtolower(class_basename($this));
     if ($event == "created") {
         $activity = new Activity();
         $activity->subject_id = $this->id;
         $activity->subject_type = get_class($this);
         $activity->name = $this->getActivityName($this, $event);
         $activity->user_id = Auth::guest() ? 0 : Auth::user()->id;
         if ($model == "category") {
             $activity->old_value = $this->name;
         } elseif ($model == "information") {
             $activity->old_value = $this->value;
         } elseif ($model == "field") {
             $activity->old_value = $this->category_label;
         } elseif ($model == "devicelog") {
             $activity->old_value = $this->action;
         } elseif ($model == "owner") {
             $activity->old_value = $this->fullName();
         } else {
             $activity->old_value = $this->name;
         }
         $activity->save();
     } elseif ($event == "updates") {
         if ($model == "category") {
             $activity = new Activity();
             $activity->subject_id = $this->id;
             $activity->subject_type = get_class($this);
             $activity->name = $this->getActivityName($this, $event);
             $activity->old_value = $this->name;
             $activity->new_value = Input::get('name');
             $activity->user_id = Auth::guest() ? 0 : Auth::user()->id;
             $activity->save();
             $this->name = Input::get('name');
             $this->save();
         } elseif ($model == "device") {
             $activity = new Activity();
             $activity->subject_id = $this->id;
             $activity->subject_type = get_class($this);
             $activity->name = $this->getActivityName($this, $event);
             $activity->old_value = $this->name;
             $activity->new_value = Input::get('phone_number');
             $activity->user_id = Auth::guest() ? 0 : Auth::user()->id;
             $activity->save();
             $this->phone_number = Input::get('name');
             $this->save();
         } elseif ($model == "information") {
             foreach (Input::all() as $key => $value) {
                 if (strpos($key, 'info') !== false) {
                     $key = explode('-', $key);
                     $info_id = $key[1];
                     $activity = new Activity();
                     $information = Information::find($info_id);
                     $activity->subject_id = $information->id;
                     $activity->subject_type = get_class($information);
                     $activity->name = $information->getActivityName($information, $event);
                     $activity->old_value = $information->value;
                     $activity->user_id = Auth::guest() ? 0 : Auth::user()->id;
                     $activity->save();
                     $information->value = $value;
                     $information->save();
                     $act = Activity::find($activity->id);
                     $act->new_value = $information->value;
                     $act->save();
                 }
             }
         }
     } elseif ($event == "deleted") {
         $activity = new Activity();
         $activity->subject_id = $this->id;
         $activity->subject_type = get_class($this);
         $activity->name = $this->getActivityName($this, $event);
         $activity->user_id = Auth::guest() ? 0 : Auth::user()->id;
         if ($model == "field") {
             $activity->old_value = $this->category_label;
         } elseif ($model == "information") {
             $activity->old_value = $this->value;
         } else {
             $activity->old_value = $this->name;
         }
         $activity->save();
     }
 }
开发者ID:encry2024,项目名称:inv_5_2,代码行数:83,代码来源:RecordsActivity.php

示例14: activities

 public function activities($num, $lead_id, $user_id)
 {
     $item = null;
     for ($i = 0; $i < $num; $i++) {
         $item = new Activity();
         $item->name = $this->faker->word();
         $item->lead_id = $lead_id;
         $item->user_id = $user_id;
         $item->note = $this->faker->text($this->faker->numberBetween(5, 500));
         $item->type = $this->faker->randomElement($array = array('sales', 'elevation'));
         $item->status = $this->faker->randomElement($array = array('done', 'scheduled'));
         if ($item->status == 'scheduled') {
             $item->schedule_time = $this->faker->dateTimeBetween($startDate = 'now', $endDate = '+1 week');
             $action = 'scheduled';
         } else {
             $item->schedule_time = date("Y-m-d H:i:s", time());
             $action = 'done';
         }
         $item->visible = $this->faker->numberBetween(0, 3);
         $item->save();
         $this->actions('activities', $action, $lead_id, $user_id, $this->faker->text(5));
     }
 }
开发者ID:bunsha,项目名称:gazingle,代码行数:23,代码来源:FakerController.php

示例15: modAdd

 public function modAdd()
 {
     $film = Input::get('film');
     $user = Input::get('user');
     $review = Input::get('review');
     $vote = Input::get('vote');
     $check = DB::table('film_review')->where('fr_usr_id', $user)->where('fr_fl_id', $film)->first();
     if ($check) {
     } else {
         if (!$review == "") {
             // inserts the review
             $rev = new Review();
             // revie instance
             $rev->fr_fl_id = $film;
             $rev->fr_usr_id = $user;
             $rev->fr_review = $review;
             $rev->fr_vote = $vote;
             $rev->fr_date = \time();
             $rev->save();
             // saves review
             // insert a new user actions
             $act = new Activity();
             // notification instance
             $act->type_id = '2';
             // activity type 2 for review
             $act->subject_id = $user;
             // id of the user
             $act->object_type = 'film';
             // type of object
             $act->object_id = $film;
             // id of the object
             $act->action_date = \time();
             // time of the activity
             $act->save();
             // saves activity
         }
     }
     // gets the review details from the given id
     $latest = DB::table('film_review')->where('fr_usr_id', $user)->orderBy('fr_id', 'desc')->first();
     $user = user::find($user);
     return view('reviews.add', compact('latest', 'user'));
 }
开发者ID:palhimanshu1991,项目名称:berdict,代码行数:42,代码来源:ReviewsController.php


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