$phone = implode('', $digits[0]);
return new User([
- 'first_name' => Str::title($row['first_name']),
- 'last_name' => Str::title($row['last_name']),
- 'email' => Str::lower($row['email']),
+ 'first_name' => trim(Str::title($row['first_name'])),
+ 'last_name' => trim(Str::title($row['last_name'])),
+ 'email' => trim(Str::lower($row['email'])),
'position' => Str::title($row['position']),
'organization_id' => $org ? $org->id : null,
'address_line_1' => $row['address_line_1'],
--- /dev/null
+<?php
+
+namespace App\Nova\Metrics;
+
+use App\User;
+use Laravel\Nova\Http\Requests\NovaRequest;
+use Laravel\Nova\Metrics\Partition;
+
+class RegistrationCompletePartition extends Partition
+{
+
+ public $name = "Comptes activés";
+
+ /**
+ * Calculate the value of the metric.
+ *
+ * @param \Laravel\Nova\Http\Requests\NovaRequest $request
+ * @return mixed
+ */
+ public function calculate(NovaRequest $request)
+ {
+ return $this->result([
+ 'Compte activé' => User::registrationComplete()->count(),
+ 'Compte non activé' => User::registrationIncomplete()->count(),
+ ]);
+ }
+
+ /**
+ * Determine for how many minutes the metric should be cached.
+ *
+ * @return \DateTimeInterface|\DateInterval|float|int
+ */
+ public function cacheFor()
+ {
+// return now()->addMinutes(5);
+ }
+
+ /**
+ * Get the URI key for the metric.
+ *
+ * @return string
+ */
+ public function uriKey()
+ {
+ return 'registration-complete';
+ }
+
+}
public function calculate(NovaRequest $request)
{
return $this->result([
- 'Abonnés (groupe)' => $s = User::hasOrgSubscription()->count(),
- 'Abonnés (indiv)' => $s = User::hasIndSubscription()->count(),
+ 'Abonnés (groupe)' => $g = User::hasOrgSubscription()->count(),
+ 'Abonnés (indiv)' => $i = User::hasIndSubscription()->count(),
"Période d'essai" => $t = User::isOnTrial()->count(),
- "Reste" => User::count() - $s - $t
+ "Reste" => User::count() - $i - $g - $t
]);
}
use App\Nova\Actions\SendNotification;
use App\Nova\Actions\StartTrial;
use App\Nova\Actions\VerifyEmail;
+use App\Nova\Metrics\RegistrationCompletePartition;
use App\Nova\Metrics\SubscribedUsers;
use App\Nova\Metrics\TotalUsers;
use App\Nova\Metrics\TrialUsers;
return [
new TotalUsers,
new UsersPartition,
+ new RegistrationCompletePartition
];
}
$builder->where('type', self::TYPE_SUBSCRIBER);
}
+ /**
+ * @param Builder $builder
+ */
+ public function scopeRegistrationComplete(Builder $builder): void
+ {
+ $builder->where('reg_complete', 1);
+ }
+
+
+ /**
+ * @param Builder $builder
+ */
+ public function scopeRegistrationIncomplete(Builder $builder): void
+ {
+ $builder->where('reg_complete', 0);
+ }
+
+