/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     /// Add sponsor
     $sponsor = new Sponsor();
     $sponsor->first_name = $request->sponsor_first_name;
     $sponsor->middle_name = $request->sponsor_middle_name;
     $sponsor->last_name = $request->sponsor_last_name;
     $sponsor->gender = $request->sponsor_gender;
     $sponsor->phone = $request->sponsor_phone;
     $sponsor->postal_address = $request->sponsor_postal_address;
     $sponsor->residence = $request->sponsor_residence;
     $sponsor->birth_date = $request->sponsor_birth_date;
     $sponsor->occupation = $request->sponsor_occupation;
     if ($sponsor->save()) {
         $application = new Application();
         $application->applicant_id = $request->applicant_id;
         $application->loan_id = $request->loan_id;
         $application->sponsor_id = $sponsor->id;
         $application->applied_amount = $request->applied_amount;
         $application->application_fee = $request->application_fee;
         $application->status = "pending";
         $application->comments = $request->comments;
         $application->collateral = $request->collateral;
         $application->collateral_value = $request->collateral_value;
         $application->created_by = 1;
         if (!$application->save()) {
             return "failed";
         } else {
             return "success";
         }
         echo json_encode($application);
     }
 }
 public function delete($id)
 {
     $sponsor = Sponsor::findOrFail($id);
     $sponsor->delete();
     $this->flasher->success('Sponsor Deleted!', 'That sponsor has been deleted');
     return redirect('admin/sponsors');
 }
 public function getInvolved()
 {
     $page = $this->contentRepository->getPageByName('get involved');
     $sponsors = Sponsor::ordered()->get();
     $charities = Charity::ordered()->get();
     $expeditionistPdf = FileResource::where('name', 'Become an expeditionist')->first();
     $volunteerPdf = FileResource::where('name', 'Become a volunteer')->first();
     return view('front.pages.getinvolved')->with(compact('page', 'sponsors', 'charities', 'expeditionistPdf', 'volunteerPdf'));
 }
 /**
  *@test
  */
 public function sponsors_can_be_ordered_by_passing_an_ordered_list_of_ids()
 {
     factory(Sponsor::class)->create(['name' => 'second', 'id' => 1]);
     factory(Sponsor::class)->create(['name' => 'first', 'id' => 2]);
     factory(Sponsor::class)->create(['name' => 'fourth', 'id' => 3]);
     factory(Sponsor::class)->create(['name' => 'third', 'id' => 4]);
     Sponsor::setOrder([2, 1, 4, 3]);
     $ordered = Sponsor::ordered()->get();
     $this->assertEquals('first', $ordered->first()->name);
     $this->assertEquals('second', $ordered[1]->name);
     $this->assertEquals('third', $ordered[2]->name);
     $this->assertEquals('fourth', $ordered->last()->name);
 }
 /**
  *@test
  */
 public function sponsors_can_have_their_order_set_by_posting_to_endpoint()
 {
     factory(Sponsor::class)->create(['name' => 'second', 'id' => 1]);
     factory(Sponsor::class)->create(['name' => 'first', 'id' => 2]);
     factory(Sponsor::class)->create(['name' => 'fourth', 'id' => 3]);
     factory(Sponsor::class)->create(['name' => 'third', 'id' => 4]);
     $this->asAnAdminUser();
     $this->withoutMiddleware();
     $response = $this->call('POST', '/admin/sponsors/order', ['order' => [2, 1, 4, 3]]);
     $this->assertEquals(200, $response->status());
     $ordered = Sponsor::ordered()->get();
     $this->assertEquals('first', $ordered->first()->name);
     $this->assertEquals('second', $ordered[1]->name);
     $this->assertEquals('third', $ordered[2]->name);
     $this->assertEquals('fourth', $ordered->last()->name);
 }
 /**
  * Show the Project view page. (BY ANDREI)
  *
  * @return project_tbl data, date, amount
  */
 public function show($slug)
 {
     // fetch data according to slug
     $project = $slug;
     $logos = Sponsor::where('active', 1)->get();
     // find the Users Favourites and catch them
     $favourites = Favourite::all()->where('user_id', Session::get('userId'))->where('project_id', $project->id);
     //dd($favourites);
     // convert DB date into european date format
     $finish_date = date("d-m-Y", strtotime($project->completed_on));
     // convert DB amounts into european currency format
     $amount_raised = number_format($project->amount_raised, 2, ',', '.');
     $target_amount = number_format($project->target_amount, 2, ',', '.');
     $galleryImages = \App\Image::where('project_id', $project->id)->get();
     return view('pages.projectpage', compact('project', 'logos', 'finish_date', 'amount_raised', 'target_amount', 'galleryImages', 'favourites'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  SponsorRequest $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(SponsorRequest $request, $id)
 {
     try {
         $sponsor = Sponsor::findOrFail($id);
         $inputs = $request->all();
         if ($request->hasFile('image')) {
             $fileName = upload($request->file('image'), 'users', $sponsor->image);
             $inputs['image'] = $fileName;
         }
         $sponsor->fill($inputs)->save();
     } catch (ModelNotFoundException $ex) {
         Flash::error('No sponsor found' . $ex);
         return redirect()->route('sponsors.index');
     }
     Flash::success('Sponsor information updated successfully');
     return redirect()->route('sponsors.index');
 }
 public function slides()
 {
     /**
      * @var $event Event
      */
     $event = (new Event())->nextEvent()->first();
     /**
      * @var $startTime Carbon
      */
     $startTime = $event->starts_at->copy();
     $startTime->setTimezone(new \DateTimeZone('Australia/Melbourne'));
     $nextEventStart = $event->followingEvent()->starts_at->copy()->setTimeZone(new \DateTimeZone('Australia/Melbourne'));
     $nextHackStart = $event->followingHacknight()->starts_at->copy()->setTimeZone(new \DateTimeZone('Australia/Melbourne'));
     $tsFilter = function ($key, $value) {
         return $key->name !== 'Teamsquare';
     };
     $sponsor = $event->sponsors->filter($tsFilter)->first();
     $sponsorHost = null;
     if ($startTime->month >= 8) {
         $sponsorHost = Sponsor::find(7);
     }
     $view = view('slides', ['sponsor' => $sponsor, 'host' => $sponsorHost, 'number' => $event->eventNumber(), 'dateString' => $startTime->format('j F, Y'), 'timezone' => $startTime->format('T'), 'nextHacknight' => $event->followingHacknight(), 'nextHackDateString' => $nextHackStart->format('j F, Y'), 'nextEvent' => $event->followingEvent(), 'nextEventDateString' => $nextEventStart->format('j F, Y')])->render();
     return response($view, 200, ['Content-Type' => 'text/plain']);
 }
 public function update(Request $request)
 {
     $this->validate($request, ['order' => 'required']);
     Sponsor::setOrder($request->order);
     return response()->json('ok');
 }
Esempio n. 10
0
 public function addSponsor(SponsorDetailsRequest $request)
 {
     // Save the new Sponsor Logo in the DB
     $sponsor = new Sponsor();
     $sponsor->user_id = 2;
     $sponsor->top_sponsor = $request->get('top_sponsor');
     $sponsor->business_name = $request->get('business_name');
     $sponsor->url = $request->get('url');
     $sponsor->online_until = '2015-12-31';
     $sponsor->ranking = $request->get('ranking');
     $sponsor->active = 1;
     $sponsor->save();
     $logo = $request->file('logo');
     if ($logo !== null) {
         // Make the image and document directories.
         $logoFolderPath = public_path("img/logos");
         // Resize the images to our needs, and save them in their directories.
         $this->resizeLogoAndSave($logo, $sponsor->business_name, $logoFolderPath);
         // Create new Image instances in the database.
         $this->saveImageToDB($logo, $sponsor->business_name, $sponsor);
         Session::flash('flash_message', trans('userpanel.logo-upload-success'));
     }
     return redirect()->back();
 }
 public function editSponsors($id)
 {
     $expedition = Expedition::findOrFail($id);
     $sponsors = Sponsor::all();
     return view('admin.expeditions.sponsors')->with(compact('expedition', 'sponsors'));
 }
    private function createSpecialEvents()
    {
        //NSBreakfast May
        $nsBreakfastMay = Carbon::create(2016, 5, 6, 8, 0, 0, new \DateTimeZone('Australia/Melbourne'));
        $nsBreakfastMay->setTimezone(new \DateTimeZone('UTC'));
        // using slug as a unique string identifier
        $slug = Str::slug(Event::SPECIAL . " {$nsBreakfastMay}");
        $this->info("Special Event (NSBreakfast) {$nsBreakfastMay} UTC");
        $event = Event::firstOrNew(['slug' => $slug]);
        $event->type = Event::SPECIAL;
        $event->slug = $slug;
        $event->title = 'NSBreakfast';
        $event->subtitle = 'Informal and unstructured; Hang out, drink coffee, eat breakfast and chat iOS / OSX';
        $event->starts_at = $nsBreakfastMay;
        $event->ends_at = $nsBreakfastMay->copy()->addHours(2);
        $event->contact = 'https://twitter.com/nsbreakfast';
        $event->contact_name = 'Matt Delves';
        $event->location = '1000 £ Bend';
        $event->location_link = 'http://thousandpoundbend.com.au';
        $event->address_display = '361 Little Lonsdale St, Melbourne';
        $event->address = '361 Little Lonsdale St, Melbourne, VIC 3000';
        $event->lat = -37.811672;
        $event->lng = 144.959092;
        $event->save();
        //NSBreakfast June
        $nsBreakfastJune = Carbon::create(2016, 6, 3, 7, 30, 0, new \DateTimeZone('Australia/Melbourne'));
        $nsBreakfastJune->setTimezone(new \DateTimeZone('UTC'));
        $slug = Str::slug(Event::SPECIAL . " {$nsBreakfastJune}");
        $this->info("Special Event (NSBreakfast) {$nsBreakfastJune} UTC");
        $event = Event::firstOrNew(['slug' => $slug]);
        $event->type = Event::SPECIAL;
        $event->slug = $slug;
        $event->title = 'NSBreakfast';
        $event->subtitle = 'Informal and unstructured; Hang out, drink coffee, eat breakfast and chat iOS / OSX';
        $event->starts_at = $nsBreakfastJune;
        $event->ends_at = $nsBreakfastJune->copy()->addHours(2);
        $event->contact = 'https://twitter.com/nsbreakfast';
        $event->contact_name = 'Matt Delves';
        $event->location = 'Hash Specialty Coffee';
        $event->location_link = 'http://facebook.com/hashcoffeeroasters';
        $event->address_display = '113 Hardware St, Melbourne';
        $event->address = '113 Hardware St, Melbourne, VIC 3000';
        $event->lat = -37.8123025;
        $event->lng = 144.9605897;
        $event->save();
        //WWDC Event June 2016
        $wwdcEventJune2016 = Carbon::create(2016, 6, 16, 18, 30, 0, new \DateTimeZone('Australia/Melbourne'));
        $wwdcEventJune2016->setTimezone(new \DateTimeZone('UTC'));
        $slug = Str::slug(Event::SPECIAL . " {$wwdcEventJune2016}");
        $this->info("Special Event (WWDC) {$wwdcEventJune2016} UTC");
        $event = Event::firstOrNew(['slug' => $slug]);
        $event->type = Event::SPECIAL;
        $event->slug = $slug;
        $event->title = 'Cocoaheads WWDC Special Event';
        $event->subtitle = <<<'EOT'
We're going to start off with a special intro I'm calling 'The Keynote That Was' (TKTW) and we will then watch two 
to three WWDC sessions. Depending on what's available at the time, we might have a few options but the best ones will be
the State of the Union sessions that are usually presented on the Tuesday morning in San Francisco.
EOT;
        $event->starts_at = $wwdcEventJune2016;
        $event->ends_at = $wwdcEventJune2016->copy()->addHours(3);
        $event->location = 'Teamsquare';
        $event->location_link = 'https://teamsquare.co/contact';
        $event->address_display = 'Level 1, 520 Bourke Street, Melbourne';
        $event->address = 'Level 1, 520 Bourke Street, Melbourne VIC 3000';
        $event->lat = -37.8153744;
        $event->lng = 144.958427;
        $event->tickets = 'http://melbournecocoaheads-wwdc-2016.eventbrite.com.au';
        $event->contact = 'https://twitter.com/melbournecocoa';
        $event->contact_name = 'Jesse Collis';
        $event->save();
        $event->sponsors()->detach();
        $event->sponsors()->attach(Sponsor::where('name', '=', 'Teamsquare')->first());
        $event->sponsors()->attach(Sponsor::where('name', 'Odecee')->first());
    }
Esempio n. 13
0
 public function sponsors()
 {
     $logos = Sponsor::where('active', 1)->where('top_sponsor', 0)->get()->sortBy('ranking');
     $top_sponsors = Sponsor::where('active', 1)->where('top_sponsor', 1)->get()->sortBy('ranking');
     return view('pages.sponsors', compact('logos', 'top_sponsors'));
 }
Esempio n. 14
0
 public function __construct()
 {
     $this->sponsors = ['' => 'Select'] + Sponsor::lists('name', 'id')->all();
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $sponsors = Sponsor::all()->load('applicants');
     return $sponsors;
 }
 protected function getSponsors()
 {
     return Cache::remember('home:sponsors', static::CACHE_DURATION, function () {
         return Sponsor::ordered()->get();
     });
 }