コード例 #1
0
ファイル: HomeController.php プロジェクト: bishopm/ncc
 public function feed()
 {
     $feed = Feed::make();
     // cache the feed for 60 minutes (second parameter is optional)
     $feed->setCache(0, 'NorthCoastCaresFeed');
     // check if there is cached feed and build new only if is not
     if (!$feed->isCached()) {
         // creating rss feed with our most recent 20 posts
         $organisations = Organisation::orderBy('created_at', 'desc')->take(20)->get();
         $projects = Project::orderBy('created_at', 'desc')->take(20)->get();
         // set your feed's title, description, link, pubdate and language
         $feed->title = 'North Coast Cares';
         $feed->description = 'Community and faith-based organisations working for good on the KZN North Coast';
         $feed->logo = 'https://scontent-cdg2-1.xx.fbcdn.net/hphotos-xta1/v/t1.0-9/12144733_644650369011345_1628028338195896677_n.png?oh=8ec9cc8612020671b85bc1fe338c7213&oe=56C020F3';
         $feed->link = url('feed');
         $feed->setDateFormat('datetime');
         // 'datetime', 'timestamp' or 'carbon'
         $feed->pubdate = date('d-m-Y');
         $feed->lang = 'en';
         $feed->setShortening(true);
         // true or false
         $feed->setTextLimit(400);
         // maximum length of description text
         foreach ($organisations as $organisation) {
             // set item's title, author, url, pubdate, description and content
             if ($organisation->photo != "") {
                 $fulldescrip = "<img height=\"60\" src=\"" . url($organisation->photo) . "\">" . $organisation->description;
             } else {
                 $fulldescrip = $organisation->description;
             }
             $feed->add("New " . strtoupper($organisation->organisationtype) . ": " . $organisation->organisation, "North Coast Cares", url('/organisations/' . $organisation->id), $organisation->created_at, $fulldescrip, $organisation->description);
         }
         foreach ($projects as $project) {
             // set item's title, author, url, pubdate, description and content
             if ($project->photo != "") {
                 $fulldescrip = "<img height=\"60\" src=\"" . url($project->photo) . "\">" . $project->description;
             } else {
                 $fulldescrip = $project->description;
             }
             $feed->add("New PROJECT: " . $project->project, "North Coast Cares", url('/projects/' . $project->id), $project->created_at, $fulldescrip, $project->description);
         }
     }
     // first param is the feed format
     // optional: second param is cache duration (value of 0 turns off caching)
     // optional: you can set custom cache key with 3rd param as string
     return $feed->render('atom');
 }
コード例 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data['fin'] = Helpers::mapme('organisation');
     $data['organisations'] = Organisation::orderBy('organisationtype')->orderBy('organisation')->get();
     return view('organisations.index', $data);
 }
コード例 #3
0
ファイル: ProjectsController.php プロジェクト: bishopm/ncc
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $data['alltags'] = Tag::orderBy('tag')->get();
     $data['organisations'] = Organisation::orderBy('organisation')->get();
     $data['project'] = Project::find($id);
     $data['ptags'] = explode(',', $data['project']->tags);
     $data['latitude'] = $data['project']->latitude;
     $data['longitude'] = $data['project']->longitude;
     return view('projects.edit', $data);
 }