Exemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $societies = Society::where('group_birthdays', '<>', 0)->select('group_birthdays', 'id', 'email', 'society')->get();
     foreach ($societies as $soc) {
         // Birthdays
         $thisyr = date("Y");
         $mon = strval(date('m-d', strtotime("next Monday")));
         $tue = strval(date('m-d', strtotime("next Monday") + 86400));
         $wed = strval(date('m-d', strtotime("next Monday") + 172800));
         $thu = strval(date('m-d', strtotime("next Monday") + 259200));
         $fri = strval(date('m-d', strtotime("next Monday") + 345600));
         $sat = strval(date('m-d', strtotime("next Monday") + 432000));
         $sun = strval(date('m-d', strtotime("next Monday") + 518400));
         $msg = "Birthdays for the week: (starting " . $thisyr . "-" . $mon . ")<br><br>";
         $days = array($mon, $tue, $wed, $thu, $fri, $sat, $sun);
         //DB::enableQueryLog();
         $birthdays = Individual::join('households', 'household_id', '=', 'households.id')->where('households.society_id', '=', $soc->id)->select('individuals.id', 'homephone', 'householdcell', 'cellphone', 'firstname', 'surname', DB::raw('substr(birthdate, 6, 5) as bd'))->wherein(DB::raw('substr(birthdate, 6, 5)'), $days)->orderBy(DB::raw('substr(birthdate, 6, 5)'))->get();
         //Log::debug(DB::getQueryLog());
         foreach ($birthdays as $bday) {
             $msg = $msg . date("D d M", strtotime($thisyr . "-" . $bday->bd)) . " " . $bday->firstname . " " . $bday->surname . ":";
             if ($bday->cellphone) {
                 $msg = $msg . " Cellphone: " . $bday->cellphone;
             }
             if ($bday->homephone) {
                 $msg = $msg . " Homephone: " . $bday->homephone;
             }
             if ($bday->householdcell and $bday->householdcell != $bday->id) {
                 $msg = $msg . " Household cellphone: " . self::gethcell($bday->householdcell);
             }
             $msg = $msg . "<br>";
             //Log::notice($bday->surname . ", " . $bday->firstname);
         }
         $anniversaries = Specialday::join('households', 'household_id', '=', 'households.id')->select('homephone', 'householdcell', 'addressee', 'household_id', 'anntype', 'details', DB::raw('substr(anniversarydate, 6, 5) as ad'))->wherein(DB::raw('substr(anniversarydate, 6, 5)'), $days)->orderBy(DB::raw('substr(anniversarydate, 6, 5)'))->get();
         $msg = $msg . "<br>" . "Anniversaries" . "<br><br>";
         foreach ($anniversaries as $ann) {
             $msg = $msg . date("D d M", strtotime($thisyr . "-" . $ann->ad)) . " (" . $ann->addressee . ". " . ucfirst($ann->anntype) . ": " . $ann->details . ")";
             if ($ann->homephone) {
                 $msg = $msg . " Homephone: " . $ann->homephone;
             }
             if ($ann->householdcell) {
                 $msg = $msg . " Household cellphone: " . self::gethcell($ann->householdcell);
             }
             $msg = $msg . "<br>";
         }
         $group = Group::with('individual')->find($soc->group_birthdays);
         foreach ($group->individual as $recip) {
             $fname = $recip->firstname;
             $name = $recip->firstname . " " . $recip->surname;
             $email = $recip->email;
             $subject = "Birthday email from " . $soc->society . " Methodist Church";
             Mail::queue('messages.message', array('msg' => "Good morning, " . $fname . " :)<br><br>" . $msg), function ($message) use($name, $email, $subject, $soc) {
                 $message->from($soc->email, $soc->society . " Methodist Church");
                 $message->to($email, $name);
                 $message->replyTo($email);
                 $message->subject($subject);
             });
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Display the specified resource.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function show($society, $slug)
 {
     $data['society'] = Society::where('society', '=', $society)->first();
     $data['soc'] = $society;
     $data['mission'] = Mission::where('slug', '=', $slug)->first();
     if ($data['mission']->subject_id) {
         $data['blogs'] = Subject::with('blog')->where('id', '=', $data['mission']->subject_id)->first();
         $data['subject'] = $data['blogs']->subject;
     }
     if ($data['mission']->category == "event") {
         $data['fbtitle'] = "For more event details on Facebook, click here";
     } elseif ($data['mission']->category == "project") {
         $data['fbtitle'] = "Follow this project on Facebook";
     }
     return view('missions.show', $data);
 }
Exemplo n.º 3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($society, $yr, $id)
 {
     if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
         $data['soc'] = $society;
         $data['society'] = Society::where('society', '=', $society)->first();
         $data['goal'] = Goal::with(array('individual' => function ($query) {
             $query->wherePivot('deleted_at', null)->orderBy('surname', 'asc');
         }))->where('slug', '=', $id)->where('society_id', '=', $data['society']->id)->first();
         $data['contact'] = Individual::find($data['goal']->contact);
         $data['pagetitle'] = $data['goal']->groupname;
         $daysofweek = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
         $data['meeting'] = $daysofweek[-1 + $data['goal']->meeting];
         return View::make('goals.show', $data);
     } else {
         return View::make("shared.unauthorised");
     }
 }
Exemplo n.º 4
0
 /**
  * Display the specified resource.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function show($society, $category)
 {
     $data['soc'] = $society;
     $data['category'] = $category;
     $data['pagetitle'] = "Downloads: " . $category;
     $data['society'] = Society::where('society', '=', $society)->first();
     $downloads = Download::orderBy('category')->orderBy('title')->get();
     $data['iscat'] = false;
     foreach ($downloads as $download) {
         $societies = explode(',', $download->societies);
         if ($download->societies == "" or in_array($data['society']->id, $societies)) {
             $data['downloads'][$download->category][] = $download;
             if ($download->category == $category) {
                 $data['iscat'] = true;
             }
         }
     }
     return view('downloads.show', $data);
 }
Exemplo n.º 5
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($society, $slug = "all")
 {
     $socid = Society::where('society', '=', $society)->first()->id;
     if ($slug == "all" or strlen($slug) == 4 and is_numeric($slug)) {
         $syears = array();
         $data['series'] = Series::with('sermon')->where('society_id', '=', $socid)->orderBy('created_at', 'DESC')->get();
         foreach ($data['series'] as $serie) {
             if (!in_array(substr($serie->created_at, 0, 4), $syears)) {
                 $syears[] = substr($serie->created_at, 0, 4);
             }
         }
         asort($syears);
         $data['syears'] = $syears;
         $data['slug'] = $slug;
         if ($slug != "all") {
             $series = Series::with('sermon')->where('society_id', '=', $socid)->orderBy('created_at', 'DESC')->get();
             $data['series'] = array();
             foreach ($series as $serie) {
                 if (substr($serie->created_at, 0, 4) == $slug) {
                     $data['series'][] = $serie;
                 }
             }
             if (!isset($data['series'])) {
                 $data['series'] = array();
             }
         }
     } else {
         $data['series'] = Series::with('sermon')->where('society_id', '=', $socid)->where('slug', '=', $slug)->get();
         $data['slug'] = $data['series'][0]->series;
     }
     $data['pagetitle'] = $society . " sermons";
     $data['soc'] = $society;
     $others = Series::has('sermon')->where('society_id', '<>', $socid)->groupBy('society_id')->lists('society_id')->toArray();
     $data['othersocieties'] = Society::wherein('id', $others)->orderBy('society')->get();
     return view('series.show', $data);
 }
Exemplo n.º 6
0
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $society = $view->getData()['soc'];
     $data['services'] = Society::with('service')->where('society', '=', $society)->first();
     foreach ($data['services']->service as $service) {
         if ($service['language'] == "English" and $service['description'] == "") {
             $service->description = "Our " . $service->servicetime . " service is led in English by a minister or local preacher and a team of musicians. Everyone is welcome!";
         } elseif ($service['language'] == "isiZulu" and $service['description'] == "") {
             $service->description = "Our " . $service->servicetime . " service is led in isiZulu by a minister or local preacher and uses the liturgy and music of the Methodist Hymn Book. Everyone is welcome!";
         }
         $data['allservices'][] = $service;
     }
     if (!count($data['services'])) {
         return View::make('errors.404');
     }
     if (isset($view->getData()['pagetitle'])) {
         $data['pagetitle'] = $view->getData()['pagetitle'];
     } else {
         $data['pagetitle'] = $society;
     }
     $socid = Society::where('society', '=', $society)->select('id')->first()->id;
     if (Helpers::is_online() and $data['services']->society_calendar != "") {
         $privatecal = new GoogleCalendar();
         $data['cals'] = $privatecal->getTen($data['services']->society_calendar, 8);
     }
     $data['sermon'] = Sermon::with(['series' => function ($query) use($socid) {
         $query->where('society_id', '=', $socid);
     }])->orderBy('servicedate', 'DESC')->first();
     if (!$data['sermon'] or !$data['sermon']->series) {
         $data['sermon'] = "None";
     } else {
         if ($data['sermon']->preachable_type == 'App\\Models\\Minister') {
             $data['preacher'] = Minister::find($data['sermon']->preachable_id);
         } elseif ($data['sermon']->preachable_type == 'App\\Models\\Guest') {
             $data['preacher'] = Guest::find($data['sermon']->preachable_id);
         } else {
             $data['preacher'] = Preacher::find($data['sermon']->preachable_id);
         }
     }
     $data['welcome_page'] = "together a transforming discipleship movement";
     $data['welcome_page_pic'] = "/public/images/715.jpg";
     if ($data['services']->roster) {
         $data['roster'] = $data['services']->roster;
     }
     $data['society'] = Society::where('society', '=', $society)->first();
     if ($data['society']->roster) {
         $data['roster'] = $data['society']->roster;
     }
     $webpage = Webpage::where('society_id', '=', $data['society']->id)->get();
     foreach ($webpage as $pg) {
         $data[$pg->fieldname] = $pg->fieldvalue;
         $data[$pg->fieldname . '_pic'] = $pg->pageimage;
     }
     $data['route'] = Route::getCurrentRoute()->getPath();
     if ($data['route'] != "{society}" and $data['route'] != "/") {
         $linkadd = Helpers::makeUrl(strtolower($society), '');
     } else {
         $linkadd = "";
     }
     $menu['link'] = $linkadd . "#sundays";
     $menu['label'] = "Sundays";
     $menu['longlabel'] = "Sunday services";
     $data['menu'][] = $menu;
     $data['youth'] = Mission::where('society_id', '=', $data['society']->id)->where('category', '=', 'youth')->orderBy('created_at')->take(5)->get();
     if (count($data['youth'])) {
         $menu['link'] = $linkadd . "#youth";
         $menu['label'] = "Youth";
         $menu['longlabel'] = "Children and Youth";
         $data['menu'][] = $menu;
     }
     $data['groups'] = Group::where('society_id', '=', $data['society']->id)->where('publish', '=', 1)->get();
     if (count($data['groups'])) {
         foreach ($data['groups'] as $obj) {
             $dum[0] = $obj->groupname;
             $dum[1] = $obj->latitude;
             $dum[2] = $obj->longitude;
             $dum[3] = Helpers::makeUrl(strtolower($data['services']->society), 'groups/' . $obj->slug);
             $fin[] = $dum;
         }
         $data['fin'] = json_encode($fin);
         $menu['link'] = "#groups";
         $menu['label'] = "Groups";
         $menu['longlabel'] = "Small groups";
         $data['menu'][] = $menu;
     } else {
         $data['fin'] = "";
     }
     $data['missions'] = Mission::where('society_id', '=', $data['society']->id)->where('category', '=', 'project')->take(5)->get();
     if (count($data['missions'])) {
         $menu['link'] = $linkadd . "#projects";
         $menu['label'] = "Projects";
         $menu['longlabel'] = "Mission projects";
         $data['menu'][] = $menu;
     }
     $blogs = Blog::with('individual')->orderBy('created_at', 'desc')->take(10)->get();
     if (count($blogs)) {
         $first = true;
         foreach ($blogs as $blog) {
             $societies = explode(',', $blog->societies);
             if (in_array($data['society']->id, $societies)) {
                 if ($first) {
                     $data['firstblog'] = $blog;
                     $first = false;
                 } else {
                     $data['blogs'][] = $blog;
                 }
             }
         }
         if (isset($data['firstblog'])) {
             $menu['link'] = $linkadd . "#blog";
             $menu['label'] = "Blog";
             $menu['longlabel'] = "Latest blogs";
             $data['menu'][] = $menu;
         }
     }
     $menu['link'] = $linkadd . "#contact";
     $menu['label'] = "Contact";
     $menu['longlabel'] = "Contact us";
     $data['menu'][] = $menu;
     $data['counter'] = 1;
     $view->with('data', $data);
 }
Exemplo n.º 7
0
 /**
  * Display the specified resource.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function show($society, $author = "all", $subject = "all")
 {
     $data['author'] = $author;
     if ($author != "all") {
         $filterindiv = Individual::where('slug', '=', $author)->first();
         $filter = "Showing posts by " . $filterindiv->firstname . " " . $filterindiv->surname;
         if ($subject != "all") {
             $filter = $filter . " tagged " . $subject;
         }
     } elseif ($subject != "all") {
         $filter = "Showing posts tagged " . $subject;
     } else {
         $filter = "Showing all posts";
     }
     $data['filter'] = $filter;
     $data['subjects'] = Subject::has('blog')->orderBy('subject')->get();
     $data['bloggers'] = Individual::has('blog')->orderBy('surname')->orderBy('firstname')->get();
     $data['soc'] = $society;
     $data['pagetitle'] = $society . " Blog";
     $data['society'] = Society::where('society', '=', $society)->first();
     $blogs = Blog::with('individual')->orderBy('created_at', 'desc')->get();
     $blogids = array();
     if (count($blogs)) {
         $first = true;
         foreach ($blogs as $blog) {
             $societies = explode(',', $blog->societies);
             if (in_array($data['society']->id, $societies)) {
                 $subjs = array();
                 $thissubjs = $blog->subject;
                 foreach ($thissubjs as $thissub) {
                     $subjs[] = $thissub->subject;
                 }
                 if ($subject == "all" or in_array($subject, $subjs)) {
                     if ($author == "all" or $author == $blog->individual->slug) {
                         $blogids[] = $blog->id;
                     }
                 }
             }
         }
     }
     $data['blogs'] = Blog::with('individual')->wherein('id', $blogids)->orderBy('created_at', 'desc')->paginate(20);
     return view('blogs.show', $data);
 }
Exemplo n.º 8
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($society, $series, $id)
 {
     $data['sermon'] = Sermon::where('slug', '=', $id)->first();
     if ($data['sermon']->preachable_type == 'App\\Models\\Minister') {
         $data['preacher'] = Minister::find($data['sermon']->preachable_id);
     } elseif ($data['sermon']->preachable_type == 'App\\Models\\Guest') {
         $data['preacher'] = Guest::find($data['sermon']->preachable_id);
     } else {
         $data['preacher'] = Preacher::find($data['sermon']->preachable_id);
     }
     $data['soc'] = $society;
     $data['society'] = Society::where('society', '=', $society)->first();
     $data['pagetitle'] = $data['sermon']->sermon;
     return view('sermons.show', $data);
 }
Exemplo n.º 9
0
 public function leadership($society)
 {
     $soc = Society::where('society', '=', $society)->first();
     $data['soc'] = $soc->society;
     $data['pagetitle'] = "Our leaders @ " . $soc->society;
     $data['leaders'] = Individual::socindiv($soc->id)->where('publish', '=', 1)->where('leadership', '<>', '')->orderBy('surname')->orderBy('firstname')->get();
     foreach (Minister::all() as $minister) {
         if (in_array($soc->id, explode(',', $minister->societies))) {
             $data['ministers'][] = $minister;
             $data['minids'][] = $minister->individual_id;
         }
     }
     if (isset($data['ministers']) and count($data['ministers']) > 1) {
         $data['addm'] = "s";
     } else {
         $data['addm'] = "";
     }
     return view('individuals.leaders', $data);
 }
Exemplo n.º 10
0
 public function feed($society)
 {
     $feed = App::make("feed");
     // cache the feed for 60 minutes (second parameter is optional)
     $feed->setCache(0, 'LowerTugelaCircuitFeed');
     // check if there is cached feed and build new only if is not
     if (!$feed->isCached()) {
         $society = Society::where('society', '=', $society)->first();
         // creating rss feed with our most recent 20 posts
         $blogs = Blog::where('created_at', '>', '2016-02-13')->orderBy('created_at', 'desc')->take(20)->get();
         $sermons = Sermon::where('servicedate', '>', '2016-02-13')->orderBy('servicedate', 'desc')->orderBy('created_at', 'desc')->take(20)->get();
         // set your feed's title, description, link, pubdate and language
         $feed->title = $society->society . ' Methodist Church';
         $feed->description = 'Together, a transforming discipleship movement';
         $feed->logo = 'http://church.net.za/public/images/logo.jpg';
         $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(120);
         // maximum length of description text
         $feeddata = array();
         foreach ($blogs as $blog) {
             // set item's title, author, url, pubdate, description and content
             if ($blog->blogimage != "") {
                 $imgurl = url($blog->blogimage);
             } elseif ($blog->individual->photo) {
                 $imgurl = url($blog->individual->photo);
             } elseif ($society->logo) {
                 $imgurl = url($society->logo);
             } else {
                 $imgurl = "http://church.net.za/public/images/logo.jpg";
             }
             $fulldescrip = strip_tags($blog->post);
             $dum['title'] = $blog->title;
             $dum['author'] = $imgurl;
             $dum['link'] = url('/blog#' . $blog->id);
             $dum['pubdate'] = $blog->created_at;
             $dum['summary'] = "A new blog post has been published on our site.";
             $dum['content'] = $fulldescrip;
             $feeddata[] = $dum;
         }
         foreach ($sermons as $sermon) {
             // set item's title, author, url, pubdate, description and content
             $seriesimage = url($sermon->series->seriesimage);
             if ($sermon->preachable_type == "App\\Models\\Guest") {
                 $preacher = $sermon->preachable->firstname . " " . $sermon->preachable->surname;
             } else {
                 $preacher = $sermon->preachable->individual->firstname . " " . ($preacher = $sermon->preachable->individual->surname);
             }
             $fulldescrip = "Recording of a sermon preached by " . $preacher . " at " . $society->society . ' Methodist Church on ' . date("l j F Y", strtotime($sermon->servicedate)) . '. Bible readings: ' . $sermon->readings;
             $dum['title'] = $sermon->sermon;
             $dum['author'] = $seriesimage;
             $dum['link'] = url('/sermons/' . $sermon->series->slug . '/' . $sermon->slug);
             $dum['pubdate'] = $sermon->servicedate . " 12:00:00";
             $dum['summary'] = "A new sermon has been uploaded to our site.";
             $dum['content'] = $fulldescrip;
             $feeddata[] = $dum;
         }
         usort($feeddata, function ($a, $b) {
             return strcmp($b["pubdate"], $a["pubdate"]);
         });
     }
     foreach ($feeddata as $fd) {
         $feed->add($fd['title'], $fd['author'], $fd['link'], $fd['pubdate'], $fd['summary'], $fd['content']);
     }
     return $feed->render('atom');
 }
Exemplo n.º 11
0
 public function report($society, $rosterid, $yy, $mm)
 {
     $pdf = new Fpdf();
     $pdf->AddPage('L');
     $logopath = base_path() . '/public/images/logo.jpg';
     $roster = Roster::with('group')->find($rosterid);
     $subcats = explode(",", $roster->subcategories);
     $weeks = self::_get_week_dates($yy, $mm, $roster->dayofweek);
     $socy = Society::where('society', '=', $society)->first();
     $churchname = ucfirst($society) . " Methodist Church";
     $society = $socy->id;
     $x = 25;
     $pdf->SetAutoPageBreak(0, 0);
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->SetTitle($churchname . " - " . $roster->rostername);
     // SET UP DATA STRUCTURE
     DB::enableQueryLog();
     foreach ($weeks as $wkno => $week) {
         foreach ($roster->group as $grp) {
             $groupin = false;
             foreach ($subcats as $skey => $subcat) {
                 if (!$subcat) {
                     $subcat = $grp->groupname;
                 }
                 if (strpos($grp->groupname, $subcat) or $subcat == $grp->groupname) {
                     $groupin = true;
                     if ($subcat != $grp->groupname) {
                         $shortgroup = trim(str_replace($subcat, "", $grp->groupname));
                     } else {
                         $shortgroup = $subcat;
                     }
                     $data[$week][$shortgroup][$subcat] = DB::table('group_individual_roster')->select('individual_id')->where('roster_id', '=', $rosterid)->where('rosterdate', '=', $week)->where('group_id', '=', $grp->id)->get();
                 }
             }
             if (!$groupin) {
                 $data[$week][$grp->groupname][$subcats[0]] = DB::table('group_individual_roster')->select('individual_id')->where('roster_id', '=', $rosterid)->where('rosterdate', '=', $week)->where('group_id', '=', $grp->id)->get();
             }
         }
         ksort($data[$week]);
     }
     $title = $churchname . ": " . $roster->rostername . " (" . date("F", strtotime($weeks[0])) . " " . $yy . ")";
     $pdf->setxy(10, 8);
     $pdf->cell(0, 0, $title, 0, 0, 'C');
     $first = true;
     $y = 33;
     foreach ($data as $kk => $wk) {
         // DISPLAY TOP HEADINGS
         if ($first) {
             $pdf->rect(10, 11, 275, 10, 'F');
             $first = false;
             $pdf->SetFont('Arial', 'B', 9);
             $pdf->SetTextColor(255, 255, 255);
             foreach ($wk as $hh => $vv) {
                 $pdf->setxy($x, $y - 21);
                 $pdf->multicell(25, 4, $hh, 0, 'C');
                 $x = $x + 32;
             }
         }
         $pdf->SetTextColor(0, 0, 0);
         $pdf->SetFont('Arial', 'B', 9);
         $pdf->setxy(10, $y - 6);
         $pdf->rect(10, $y - 8, 275, 33);
         $pdf->cell(0, 0, date("j F Y", strtotime($kk)), 0, 0, 'C');
         $x = 25;
         $veryfirst = true;
         foreach ($wk as $grp) {
             $y3 = $y - 2;
             if ($veryfirst) {
                 foreach ($subcats as $ssc) {
                     $pdf->setxy(10, $y3);
                     $pdf->cell(10, 0, $ssc);
                     $y3 = $y3 + 10.5;
                 }
                 $veryfirst = false;
             }
             $pdf->SetFont('Arial', '', 9);
             $y2 = $y - 2;
             foreach ($grp as $kk => $sc) {
                 foreach ($sc as $kkk => $vv) {
                     $pdf->setxy($x, $y2);
                     $pdf->cell(25, 0, Helpers::get_indiv($vv->individual_id), 0, 0, 'C');
                     $y2 = $y2 + 3.5;
                 }
                 if (count($sc) < count($subcats)) {
                     $y2 = $y2 + 3.5 * (count($subcats) - count($sc));
                 }
             }
             $x = $x + 32;
         }
         $y = 7 + $y + 10 * count($subcats);
     }
     $pdf->Output();
     exit;
 }
Exemplo n.º 12
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $cirname = str_replace(' ', '', strtolower(Helpers::getSetting('circuit_name')));
     if ($id == $cirname or $id == "www") {
         return redirect()->route('home');
     } else {
         $socname = Society::where('society', '=', $id)->count();
         if (!$socname) {
             return redirect()->route('home');
         }
     }
     $data['soc'] = $id;
     return View::make('societies.show', $data);
 }