改进 代码
This commit is contained in:
parent
2821c1a275
commit
a19b5f865c
@ -5,7 +5,6 @@
|
|||||||
use App\Exceptions\EmqxSupportException;
|
use App\Exceptions\EmqxSupportException;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Support\EmqxSupport;
|
use App\Support\EmqxSupport;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
use Illuminate\Http\Client\PendingRequest;
|
use Illuminate\Http\Client\PendingRequest;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class EmqxSupport
|
class EmqxSupport
|
||||||
{
|
{
|
||||||
@ -61,7 +62,8 @@ public function clients($params = [])
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$response = $this->api()->get('clients', $params);
|
$response = $this->api()->get('clients', $params);
|
||||||
} catch (ConnectionException $e) {
|
} /** @noinspection PhpRedundantCatchClauseInspection */ catch (ConnectionException $e) {
|
||||||
|
Log::error('emqx connect failed.', [$e]);
|
||||||
throw new EmqxSupportException('EMQX API 无法连接。');
|
throw new EmqxSupportException('EMQX API 无法连接。');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
* @extends Factory<User>
|
||||||
*/
|
*/
|
||||||
class UserFactory extends Factory
|
class UserFactory extends Factory
|
||||||
{
|
{
|
||||||
@ -15,7 +16,7 @@ class UserFactory extends Factory
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function definition()
|
public function definition(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => fake()->name(),
|
'name' => fake()->name(),
|
||||||
@ -31,7 +32,7 @@ public function definition()
|
|||||||
*
|
*
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function unverified()
|
public function unverified(): static
|
||||||
{
|
{
|
||||||
return $this->state(fn(array $attributes) => [
|
return $this->state(fn(array $attributes) => [
|
||||||
'email_verified_at' => null,
|
'email_verified_at' => null,
|
||||||
|
@ -12,7 +12,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function run()
|
public function run(): void
|
||||||
{
|
{
|
||||||
// \App\Models\User::factory(10)->create();
|
// \App\Models\User::factory(10)->create();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user