diff --git a/app/Event.php b/app/Event.php
index 555c1657b..3f2ec3adb 100644
--- a/app/Event.php
+++ b/app/Event.php
@@ -13,12 +13,12 @@
use Log;
use Spatie\Activitylog\Traits\LogsActivity;
use Laravel\Nova\Actions\Actionable;
+
class Event extends Model
{
use LogsActivity, Actionable;
-
protected $table = 'events';
protected $fillable = [
'status', 'title', 'slug', 'organizer', 'description',
@@ -72,7 +72,7 @@ public function path()
public function picture_path()
{
- if ($this->picture){
+ if ($this->picture) {
return env('AWS_URL') . $this->picture;
} else {
return 'https://s3-eu-west-1.amazonaws.com/codeweek-dev/events/pictures/event_default_picture.png';
@@ -146,13 +146,14 @@ public function getClosest()
}
- public function notifyAmbassadors(){
+ public function notifyAmbassadors()
+ {
//Get the ambassador list based on the event country
$ambassadors = User::role('ambassador')->where('country_iso', $this->country_iso)->get();
- if ($ambassadors->isEmpty()){
+ if ($ambassadors->isEmpty()) {
Mail::to('info@codeweek.eu')->queue(new \App\Mail\EventCreatedNoAmbassador($this));
- }else {
+ } else {
//send emails
foreach ($ambassadors as $ambassador) {
Mail::to($ambassador->email)->queue(new \App\Mail\EventCreated($this, $ambassador));
@@ -161,16 +162,23 @@ public function notifyAmbassadors(){
}
- public function approve(){
+ public function approve()
+ {
- $data = ['status' => "APPROVED", 'approved_by' => auth()->user()->id];
+ $data = ['status' => "APPROVED", 'approved_by' => auth()->user()->id];
-
$this->update($data);
- Mail::to($this->owner->email)->queue(new \App\Mail\EventApproved($this, $this->owner));
+
+ if (!empty($this->user_email)) {
+ Mail::to($this->user_email)->queue(new \App\Mail\EventApproved($this, $this->owner));
+ } else if (!is_null($this->owner) && (!is_null($this->owner->email))) {
+ Mail::to($this->owner->email)->queue(new \App\Mail\EventApproved($this, $this->owner));
+ }
+
+
return true;
}
diff --git a/app/Http/Controllers/ScoreboardController.php b/app/Http/Controllers/ScoreboardController.php
index be38edc5b..63669d14e 100644
--- a/app/Http/Controllers/ScoreboardController.php
+++ b/app/Http/Controllers/ScoreboardController.php
@@ -12,6 +12,11 @@ class ScoreboardController extends Controller
public function index()
{
+ $total = DB::table('events')
+ ->where('status',"=","APPROVED")
+ ->whereYear('end_date', '>=', Carbon::now('Europe/Brussels')->year)
+ ->count();
+
$events = DB::table('events')
->join('countries', 'events.country_iso', '=', 'countries.iso')
->select('countries.iso', 'countries.name as country_name','countries.population as country_population', DB::raw('count(*) as total'), DB::raw('countries.population / count(*) as rank'))
@@ -21,6 +26,9 @@ public function index()
->orderBy('rank','asc')
->get();
- return view('scoreboard', ['events'=>$events]);
+ return view('scoreboard', [
+ 'events'=>$events,
+ 'total'=>$total
+ ]);
}
}
diff --git a/app/Providers/NovaServiceProvider.php b/app/Providers/NovaServiceProvider.php
index d7d0d6855..fdb357fa9 100644
--- a/app/Providers/NovaServiceProvider.php
+++ b/app/Providers/NovaServiceProvider.php
@@ -43,7 +43,7 @@ protected function gate()
{
Gate::define('viewNova', function ($user) {
return in_array($user->email, [
- "alainvd@gmail.com"
+ "alainvd@gmail.com","raphdom@gmail.com"
]);
});
}
diff --git a/public/css/ext/style.css b/public/css/ext/style.css
index c4bd6dd57..188130341 100755
--- a/public/css/ext/style.css
+++ b/public/css/ext/style.css
@@ -13127,4 +13127,14 @@ textarea.border-form-control {
.youtube-iframe{
width:100%;
+}
+
+.scoreboard-total{
+ text-align: center;
+ font-size: 24px;
+ padding: 15px;
+}
+
+.country-name.macedonia {
+ font-size: 10px;
}
\ No newline at end of file
diff --git a/resources/views/ambassadors.blade.php b/resources/views/ambassadors.blade.php
index 7d1a27150..b94deab95 100755
--- a/resources/views/ambassadors.blade.php
+++ b/resources/views/ambassadors.blade.php
@@ -123,7 +123,7 @@ class="social-icon inline-block si-small si-light si-rounded si-gplus">
-
- @lang('scoreboard.paragraph')
+@lang('scoreboard.parcipating_with')
+@lang('scoreboard.parcipating_with')
+