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


PHP Activity::all方法代码示例

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


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

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

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

示例3: index

 public function index(Manager $fractal, ActivityTransformer $activityTransformer)
 {
     // show all
     $records = Activity::all();
     $collection = new Collection($records, $activityTransformer);
     $data = $fractal->createData($collection)->toArray();
     return $this->respond($data);
 }
开发者ID:wyrover,项目名称:lenda-api,代码行数:8,代码来源:ActivitiesController.php

示例4: index

 public function index()
 {
     $activities = Activity::all()->take(2);
     $title = trans('default.home');
     $locale = App::getLocale();
     $homeText = HomeText::first();
     $sliders = Slider::all();
     return view('pages.index', compact('title', 'activities', 'locale', 'homeText', 'sliders'));
 }
开发者ID:fabricedeplancke,项目名称:laravel,代码行数:9,代码来源:PagesController.php

示例5: showActivitySelectView

 public function showActivitySelectView()
 {
     $activities = Activity::all();
     $activitiesByTaskGroups = $activities->groupBy('task_group');
     $activitiesByTaskGroups = $activitiesByTaskGroups->map(function ($item, $key) {
         return collect([$key => $item]);
     });
     $groups = Group::all();
     $activitiesByAgeGroups = $activitiesByTaskGroups->groupBy(function ($item, $key) {
         return $item->first()->first()->age_group;
     });
     return view('ActivityPlanning/activitySelection', compact('activitiesByAgeGroups', 'groups'));
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:13,代码来源:ActivityPlanningController.php

示例6: getAllActivities

 public function getAllActivities()
 {
     if (Auth::check()) {
         # code...
         if (Auth::user()->type == 2) {
             # code...
             $activities = Activity::all();
             return view('subscription.subscribe', compact('activities'));
         }
         return redirect('/');
     }
     return redirect('/');
 }
开发者ID:a-madhukar,项目名称:Yahya,代码行数:13,代码来源:SubscriberController.php

示例7: performIntuitiveAssignment

 public function performIntuitiveAssignment()
 {
     $activities = Activity::all();
     //create an ass0ciative array representing the am0unt 0f succesful applicatins
     //there has been f0r each supp0rt activity, where the key is the activity's primary key
     //in the database, and the value is the number 0f succesful applicati0ns.
     $activityApplicationTally = array();
     foreach ($activities as $activity) {
         //c0unt the number 0f succesful applicati0ns f0r the activity
         $numSuccesfulApplicants = $activity->getSuccessfulApplications->count();
         //it is imp0ssible t0 intuitively assign phd students t0 the activity
         //if the activity has had n0 succesful applicants, theref0re 0nly activities
         //which have at least 1 succesful applicati0n will be added t0 the ass0ciative array
         if ($numSuccesfulApplicants > 0) {
             $activityApplicationTally[$activity->id] = $numSuccesfulApplicants;
         }
     }
     //fr0m http://www.w3schools.com/php/func_array_asort.asp
     //s0rt the ass0ciative array s0 that the activities with the fewest number 0f sucessful
     //applicants will be pr0cessed first.
     asort($activityApplicationTally, SORT_NUMERIC);
     //pr0cess the activties in the assci0ative array 1 by 1.
     $assignmentsMade = array();
     //Ass0ciative array where key is the PHD student's ID in the database and
     //the value is the id 0f the activity t0 which they were assigned
     foreach ($activityApplicationTally as $activityID => $numSuccesfulApplicants) {
         $numTutorsRequired = Activity::find($activityID)->quant_ppl_needed;
         if ($numSuccesfulApplicants == $numTutorsRequired) {
             $activity = Activity::find($activityID);
             $successfulApplications = $activity->getSuccessfulApplications;
             //assign the succesful applicants t0 all sessi0ns f0r the activity
             foreach ($successfulApplications as $successfulApplication) {
                 $phdStudent = User::find($successfulApplication->user_id);
                 //line bel0w fr0m here https://laravel.com/docs/master/collections#method-pluck, why d0es this w0rk?
                 $phdStudentSessions = $phdStudent->sessions()->attach($activity->sessions->pluck('id')->all());
                 $assignmentsMade[$phdStudent->name] = $activity->title;
             }
         }
     }
     //foreach($assignments as $assignment) {
     //var_dump($assignment);
     //}
     return view('intuitiveAssignmentResults')->with('assignmentsMade', $assignmentsMade);
     //var_dump( $assignments);
     //var_dump($phdStudentSessions);
     //return  $phdStudentSessions;
 }
开发者ID:sreilly1,项目名称:Final-Year-SE-Project,代码行数:47,代码来源:IntuitiveAssignmentController.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     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,代码行数:28,代码来源:EventTableSeeder.php

示例9: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id)
 {
     $data = Activity::all();
     return response()->json(json_encode($data));
 }
开发者ID:gokigoks,项目名称:ontheway_webservice,代码行数:11,代码来源:ActivityController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return Activity::all()->toJson();
 }
开发者ID:sax69sax,项目名称:task-manager-api,代码行数:9,代码来源:ActivityController.php

示例11: getAll

 public function getAll()
 {
     return \App\Activity::all();
 }
开发者ID:crow1796,项目名称:technologyRIS,代码行数:4,代码来源:ActivityLogRepository.php

示例12: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $activities = Activity::all();
     $title = 'Administration des activités';
     return view('admin.activities.index', compact('activities', 'title'));
 }
开发者ID:fabricedeplancke,项目名称:laravel,代码行数:11,代码来源:ActivitiesController.php

示例13: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $activities = Activity::all();
     return view('activities.index', compact('activities'));
 }
开发者ID:johanWP,项目名称:pandora,代码行数:10,代码来源:ActivitiesController.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $activities = Activity::all();
     return response()->json($activities);
 }
开发者ID:shempignon,项目名称:stupid-crm,代码行数:10,代码来源:ActivityController.php

示例15: apiIndex

 public function apiIndex()
 {
     $activity = Activity::all();
     return Response::json(['data' => $activity->toArray()], 200);
 }
开发者ID:adamaulia,项目名称:tubes-RAI,代码行数:5,代码来源:ActivityController.php


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