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


PHP app\Activity类代码示例

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


在下文中一共展示了Activity类的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: 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

示例3: 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

示例4: 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

示例5: authenticate

 public function authenticate()
 {
     $username = Input::get('username');
     $password = Input::get('password');
     $remember = Input::get('remember');
     if (Auth::viaRemember() || Auth::attempt(['email' => $username, 'password' => $password], $remember) || Auth::attempt(['username' => $username, 'password' => $password], $remember)) {
         // Authentication passed...
         $thisactivity = new Activity();
         $thisactivity->createActivity(Auth::user(), 'login', 'have logged in', 0);
         return redirect()->intended('/home');
     } else {
         return redirect()->intended('/login')->withErrors(['Username and/or Password you entered does not belong to any user']);
     }
 }
开发者ID:ralphjesy12,项目名称:cdts,代码行数:14,代码来源:AuthController.php

示例6: 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

示例7: performIntuitiveAssignment

 public function performIntuitiveAssignment()
 {
     //Grab all the activities
     $activities = Activity::all();
     //pr0duce a tally 0f h0w many succesful applicati0ns each activity has received,
     //in the f0rm 0f an ass0ciative array f0r th0se activities which have received
     //m0re than 0 applicati0ns
     $activityApplicationTally = array();
     foreach ($activities as $activity) {
         //get a c0unt 0f the number 0f succesful applicants f0r this activity
         $numSuccesfulApplicants = $activity->getSuccessfulApplications->count();
         if ($numSuccesfulApplicants > 0) {
             $activityApplicationTally[$activity->id] = $numSuccesfulApplicants;
         }
     }
     //fr0m http://www.w3schools.com/php/func_array_asort.asp
     asort($activityApplicationTally, SORT_NUMERIC);
     foreach ($activityApplicationTally as $activityID => $numSuccesfulApplicants) {
         $numTutorsRequired = Activity::find($activityID)->quant_ppl_needed;
         echo $numTutorsRequired;
         //var_dump($activity);
     }
     //return $activityApplicationTally;
     //return Activity::with('activityRequests');
 }
开发者ID:sreilly1,项目名称:Final-Year-SE-Project,代码行数:25,代码来源:IntuitiveAssignmentController0ld.php

示例8: initData

 private function initData()
 {
     $this->login();
     factory(App\Activity::class, 50)->create();
     factory(App\User::class, 10)->create();
     factory(App\User::class, 'admin', 1)->create();
     factory(App\Group::class, 25)->create()->each(function ($g) {
         for ($i = 0; $i < 5; $i++) {
             $g->users()->save(factory(App\User::class)->make(), ['role' => 'member']);
         }
         $g->users()->save(factory(App\User::class)->make(), ['role' => 'leader']);
     });
     factory(App\Event::class, 5)->create()->each(function ($event) {
         $date = $event->time->startOfDay();
         $endDate = $event->endDate;
         do {
             $occurrence = new EventOccurrence();
             $occurrence->event_id = $event->id;
             $occurrence->date = $date;
             $occurrence->save();
             $date->addWeek();
         } while ($date < $endDate);
     });
     $faker = Faker\Factory::create();
     $occurrences = EventOccurrence::all();
     $activities = Activity::all()->toArray();
     foreach ($occurrences as $occurrence) {
         foreach ($faker->randomElements($activities, $faker->randomDigit) as $activity) {
             $occurrence->activities()->attach($activity['id']);
         }
     }
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:32,代码来源:EventOccurrenceViewTest.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     // Create a faker, add en_SG providers
     $faker->addProvider(new Faker\Provider\en_SG\Address($faker));
     $faker->addProvider(new Faker\Provider\en_SG\Enhanced($faker));
     $faker->addProvider(new Faker\Provider\en_SG\Person($faker));
     $faker->addProvider(new Faker\Provider\en_SG\PhoneNumber($faker));
     $faker->seed(9876);
     // Calling the same script twice with the same seed produces the same results
     $durations = [30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180];
     // Insert 30 dummy records
     foreach (range(1, 30) as $index) {
         $startDate = $faker->dateTimeBetween('-3 months', '3 months');
         $startHour = ['08', '09', '10', '11', '13', '14', '15', '16'];
         $startMin = ['00', '15', '30', '45'];
         while (Carbon::instance($startDate)->dayOfWeek === Carbon::SUNDAY) {
             $startDate = $faker->dateTimeBetween('-3 months', '3 months');
         }
         if ($startDate === Carbon::SATURDAY) {
             $startHour = ['08', '09', '10', '11'];
         }
         $startTime = $faker->randomElement($startHour) . ":" . $faker->randomElement($startMin) . ":00";
         $elderly = Elderly::with('centre')->find($faker->numberBetween(1, 15));
         $staffList = $elderly->centre->staff->lists('staff_id')->toArray();
         Activity::create(['datetime_start' => $startDate->format('Y-m-d') . " " . $startTime, 'expected_duration_minutes' => $faker->randomElement($durations), 'category' => 'transport', 'more_information' => $faker->optional(0.4, '')->sentence(10, true), 'location_from_id' => $elderly->centre_id, 'location_to_id' => $faker->numberBetween(4, 6), 'elderly_id' => $elderly->elderly_id, 'centre_id' => $elderly->centre_id, 'staff_id' => $faker->randomElement($staffList)]);
     }
 }
开发者ID:jonnylow,项目名称:CrowdSourcingApplicationWeb,代码行数:33,代码来源:ActivitiesTableSeeder.php

示例10: transformOutMany

 public static function transformOutMany($activities)
 {
     foreach ($activities as $k => $v) {
         $activities[$k] = Activity::transformOut($v);
     }
     return $activities;
 }
开发者ID:tfarneau,项目名称:wandr,代码行数:7,代码来源:Activity.php

示例11: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->bind('devices', function ($slug) {
         return \App\Device::findBySlugOrFail($slug);
     });
     $router->bind('types', function ($slug) {
         return \App\DeviceType::findBySlugOrFail($slug);
     });
     $router->bind('locations', function ($slug) {
         return \App\DeviceLocation::findBySlugOrFail($slug);
     });
     $router->bind('admins', function ($slug) {
         return \App\User::findBySlugOrFail($slug);
     });
     $router->bind('systemusers', function ($slug) {
         return \App\User::findBySlugOrFail($slug);
     });
     $router->bind('activitylogs', function ($id) {
         return \App\Activity::findOrFail($id);
     });
     $router->bind('userlogs', function ($id) {
         return \App\UserLog::findOrFail($id);
     });
     $router->bind('authuser', function ($slug) {
         return \App\User::findBySlugOrFail($slug);
     });
 }
开发者ID:crow1796,项目名称:technologyRIS,代码行数:35,代码来源:RouteServiceProvider.php

示例12: update

 public function update($id, Request $request)
 {
     if ($this->inputIsValid($request)) {
         $agenda = Agenda::findOrFail($id);
         $agenda->update($request->except('attendees', 'activities'));
         // Remove all old attendees.
         $agenda->users()->detach();
         // Add attendees to agenda_user table as many-to-many relationship.
         foreach ($request->input('attendees') as $attendeeId) {
             $agenda->users()->attach(1, ['agenda_id' => $agenda->id, 'user_id' => $attendeeId]);
         }
         // Remove this agenda_id from all its activities.
         foreach ($agenda->activities() as $activity) {
             $activity = Activity::find($activityId);
             $activity->agenda_id = 0;
             $activity->save();
         }
         // Add agenda_id to a_activities table.
         foreach ($request->input('activities') as $activityId) {
             $activity = Activity::find($activityId);
             $activity->agenda_id = $agenda->id;
             $activity->save();
         }
         return response()->json(['header' => 'Your agenda was successfully updated!', 'info' => 'Both your agenda here on Meeter and you Google
               Calendar event were updated with your changes.'], 200);
     } else {
         return response()->json('', 400);
     }
 }
开发者ID:ninaolo,项目名称:DH2642-project,代码行数:29,代码来源:AgendasController.php

示例13: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $actArray = POF::getItem(Activity::findOrFail($id)->guid);
     $activity = Activity::findOrFail($id);
     $singleActArray = ['title' => array_get($actArray, 'title', 'ei määritetty'), 'guid' => array_get($actArray, 'guid', 'ei määritetty'), 'content' => array_get($actArray, 'content', 'ei määritetty'), 'pakollisuus' => array_get($actArray, 'tags.pakollisuus.name', 'ei määritetty'), 'pakollisuusikoni' => array_get($actArray, 'tags.pakollisuus.0.icon', 'ei määritetty'), 'ryhmakoko' => array_get($actArray, 'tags.ryhmakoko.0.name', 'ei määritetty'), 'agegroup' => array_get($actArray, 'parents.1.title'), 'paikka' => array_get($actArray, 'tags.paikka.0.name', 'ei määritetty'), 'suoritus_kesto' => array_get($actArray, 'tags.suoritus_kesto.name', 'ei määritetty')];
     return view('activity', compact('singleActArray', 'activity'));
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:13,代码来源:ActivityController.php

示例14: handle

 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $this->menu->updated_at = Carbon::now();
     $this->menu->update($this->request->all());
     Activity::create(['text' => $this->auth->linkedName() . ' updated menu named ' . $this->menu->linkedName(), 'user_id' => $this->auth->id]);
     Session::flash('flash_message', 'You have updated menu!');
 }
开发者ID:ronal2do,项目名称:Laravel-CMS,代码行数:12,代码来源:UpdateMenuCommand.php

示例15: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $item = Activity::find($id);
     $item->status = 'deleted';
     $item->save();
     Log::create(array("user_id" => Auth::user()->id, "action" => "Delete Activities named " . $item->name));
 }
开发者ID:kelvinmbwilo,项目名称:VVS,代码行数:13,代码来源:ActivitiesController.php


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