public function deleteCategory($id)
 {
     if (Request::ajax()) {
         $arrReturn = ['status' => 'error', 'message' => 'Please refresh and try again.'];
         try {
             $category = Category::findorFail($id);
         } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
             return App::abort(404);
         }
         $name = $category->name;
         if ($category->delete()) {
             $arrReturn = ['status' => 'ok', 'message' => "<b>{$name}</b> has been deleted."];
         }
         return $arrReturn;
     }
     return App::abort(404);
 }
Example #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $category = Category::findorFail($id);
     $category->delete();
 }
 public function run()
 {
     $event = new CalendarEvent();
     $event->title = 'Youth Concert';
     $event->address = 'P Sherman 42 Wallaby Way';
     $event->city = 'San Antonio';
     $event->zipcode = '89203';
     $event->date = '2016-09-02';
     $event->time = '5:00';
     $event->time_of_day = 'PM';
     $event->cost = '$20.00';
     $event->description = 'A youth concert at the Alamo Coliseum that runs from 5PM to 8PM';
     $this->getImage($event);
     $event->category_id = Category::findorFail(1)->id;
     $event->user_id = User::findorFail(1)->id;
     $event->church_id = Church::findorFail(1)->id;
     $event->save();
     // $event->users()->attach(1);
     $event1 = new CalendarEvent();
     $event1->title = 'Adult Retreat';
     $event1->address = 'P Allen 42 Wallaby Way';
     $event1->city = 'San Antonio';
     $event1->zipcode = '78201';
     $event1->date = '2016-02-02';
     $event1->time = '5:00';
     $event1->time_of_day = 'PM';
     $event1->cost = '$20.00';
     $event1->description = 'An adult retreat at the Antonian that runs from Friday to Sunday';
     $this->getImage($event1);
     $event1->category_id = Category::findorFail(2)->id;
     $event1->user_id = User::findorFail(2)->id;
     $event1->church_id = Church::findorFail(2)->id;
     $event1->save();
     // $event->users()->attach(2);
     $event2 = new CalendarEvent();
     $event2->title = 'Church Cook-out';
     $event2->address = 'Loma Linda Express Way';
     $event2->city = 'San Antonio';
     $event2->zipcode = '78209';
     $event2->date = '2016-03-02';
     $event2->time = '3:00';
     $event2->time_of_day = 'PM';
     $event2->cost = '$20.00';
     $event2->description = 'Come join the church for our yearly spring cookout';
     $this->getImage($event2);
     $event2->category_id = Category::findorFail(11)->id;
     $event2->user_id = User::findorFail(3)->id;
     $event2->church_id = Church::findorFail(3)->id;
     $event2->save();
     // $event->users()->attach(3);
     $event3 = new CalendarEvent();
     $event3->title = 'Youth Choir Tryouts';
     $event3->address = '204 Bandera Road';
     $event3->city = 'San Antonio';
     $event3->zipcode = '78228';
     $event3->date = '2016-02-02';
     $event->time = '2:00';
     $event->time_of_day = 'PM';
     $event3->cost = 'Free';
     $event3->description = 'Play an instrument sing? Come tryout for the youth choir!';
     $this->getImage($event3);
     $event3->category_id = Category::findorFail(1)->id;
     $event3->user_id = User::findorFail(4)->id;
     $event3->church_id = Church::findorFail(4)->id;
     $event3->save();
     $event4 = new CalendarEvent();
     $event4->title = 'Women Adult Retreat';
     $event4->address = '265 W Military Road';
     $event4->city = 'San Antonio';
     $event4->zipcode = '78202';
     $event4->date = '2016-04-02';
     $event4->time = '5:00';
     $event4->time_of_day = 'PM';
     $event4->cost = 'Free';
     $event4->description = 'Our church is having a women retreat up soon in April. Come by the pavillion after church on Sunday for more info!';
     $this->getImage($event4);
     $event4->category_id = Category::findorFail(2)->id;
     $event4->user_id = User::findorFail(1)->id;
     $event4->church_id = Church::findorFail(1)->id;
     $event4->save();
     $event5 = new CalendarEvent();
     $event5->title = 'Spanish Mass';
     $event5->address = '354 Bobcat Drive';
     $event5->city = 'San Antonio';
     $event5->zipcode = '78218';
     $event5->date = '2015-05-02';
     $event5->time = '2:00';
     $event5->time_of_day = 'PM';
     $event5->cost = 'Free';
     $event5->description = 'Our church has decided to incorporate a Spanish mass at 2 PM every Sunday. Come and join us!';
     $this->getImage($event5);
     $event5->category_id = Category::findorFail(10)->id;
     $event5->user_id = User::findorFail(2)->id;
     $event5->church_id = Church::findorFail(2)->id;
     $event5->save();
     $event6 = new CalendarEvent();
     $event6->title = 'Financial Classes';
     $event6->address = '103 Bandera Road';
     $event6->city = 'San Antonio';
     $event6->zipcode = '78240';
     $event6->date = '2016-08-02';
     $event6->time = '5:00';
     $event6->time_of_day = 'PM';
     $event6->cost = 'Free';
     $event6->description = 'Gordon Ramsey will be offering classes at Joyful Church regarding finances. Come our church pavillion for more info!';
     $this->getImage($event6);
     $event6->category_id = Category::findorFail(7)->id;
     $event6->user_id = User::findorFail(3)->id;
     $event6->church_id = Church::findorFail(3)->id;
     $event6->save();
     $event7 = new CalendarEvent();
     $event7->title = 'Guitar Performance';
     $event7->address = '105 Bandera Road';
     $event7->city = 'San Antonio';
     $event7->zipcode = '78202';
     $event7->date = '2016-07-02';
     $event7->time = '2:00';
     $event7->time_of_day = 'PM';
     $event7->cost = 'Free';
     $event7->description = 'Watch the advanced and intermediate guitar ensemble perform renditions of Christmas tunes!';
     $this->getImage($event7);
     $event7->category_id = Category::findorFail(1)->id;
     $event7->user_id = User::findorFail(4)->id;
     $event7->church_id = Church::findorFail(4)->id;
     $event7->save();
     // $event->users()->attach(1);
     $event8 = new CalendarEvent();
     $event8->title = 'Vacation Bible Study';
     $event8->address = '3405 Bandera Road';
     $event8->city = 'San Antonio';
     $event8->zipcode = '78217';
     $event8->date = '2016-06-02';
     $event8->time = '6:00';
     $event8->time_of_day = 'PM';
     $event8->cost = 'Free';
     $event8->description = 'Vacation Bible Study will be offered to kids ages 7-14 on Sunday at 6-8 PM for kids ages 7-11 and on Monday 6-8 PM for ages 12-14!';
     $this->getImage($event8);
     $event8->category_id = Category::findorFail(4)->id;
     $event8->user_id = User::findorFail(1)->id;
     $event8->church_id = Church::findorFail(1)->id;
     $event8->save();
     $event9 = new CalendarEvent();
     $event9->title = 'Youth Sports';
     $event9->address = '352 Fredericksburg Road';
     $event9->city = 'San Antonio';
     $event9->zipcode = '78254';
     $event9->date = '2015-03-12';
     $event9->time = '2:00';
     $event9->time_of_day = 'PM';
     $event9->cost = 'Free';
     $event9->description = 'Youth intramural sports will begin in !';
     $this->getImage($event9);
     $event9->category_id = Category::findorFail(3)->id;
     $event9->user_id = User::findorFail(2)->id;
     $event9->church_id = Church::findorFail(2)->id;
     $event9->save();
     $event10 = new CalendarEvent();
     $event10->title = 'Choir Concert';
     $event10->address = '153 Bandera Road';
     $event10->city = 'San Antonio';
     $event10->zipcode = '78202';
     $event10->date = '2015-05-02';
     $event10->time = '7:00';
     $event10->time_of_day = 'PM';
     $event10->cost = 'Free';
     $event10->description = 'Watch the girls and boys choir concert at 7 PM. They have been working hard on rehearsals for the past few months so come and support!';
     $this->getImage($event10);
     $event10->category_id = Category::findorFail(1)->id;
     $event10->user_id = User::findorFail(3)->id;
     $event10->church_id = Church::findorFail(3)->id;
     $event10->save();
 }