mimi0110

Member Since 6 Months Ago

Experience Points
230
Total
Experience

4,770 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 1
230 XP
Feb
23
1 week ago
Activity icon

Replied to Does Laravel Disconnect To Database After Each Query?

did you mean mysqli.allow_persistent ? I checked and the value is: mysqli.allow_persisten: On so does it related to sleep connection?

Activity icon

Replied to Does Laravel Disconnect To Database After Each Query?

what things should I check with this funtion?

phpinfo()

Activity icon

Replied to Does Laravel Disconnect To Database After Each Query?

It may not related to Pdo, because persitent is false :(

PDOConnection {#966
  inTransaction: false
  attributes: {
    CASE: NATURAL
    ERRMODE: EXCEPTION
    AUTOCOMMIT: 1
    PERSISTENT: false
    DRIVER_NAME: "mysql"
    SERVER_INFO: "Uptime: 333968  Threads: 13  Questions: 4355626  Slow queries: 0  Opens: 644  Flush tables: 1  Open tables: 570  Queries per second avg: 13.042"
    ORACLE_NULLS: NATURAL
    CLIENT_VERSION: " "
    SERVER_VERSION: "5.7.12"
    STATEMENT_CLASS: array:2 [
      0 => "Doctrine\DBAL\Driver\PDOStatement"
      1 => []
    ]
    EMULATE_PREPARES: 0
    CONNECTION_STATUS: " via TCP/IP"
    DEFAULT_FETCH_MODE: BOTH
  }
}

anything else can I check?

Activity icon

Replied to Does Laravel Disconnect To Database After Each Query?

around 40 sleep process always keep on my DB.

against how many PHP processes do you have

How to know that?

Activity icon

Replied to Does Laravel Disconnect To Database After Each Query?

Deploy clean Laravel app to use that same database. Add few models and run few cron jobs that access the database.

That sound good idea for investigate. it may take time now , also my issue come from production env. the sleep connection may not consum more CPU RDS but it occupied the connection in max connection we have..

Activity icon

Replied to Does Laravel Disconnect To Database After Each Query?

thank for your quick reply. I can make sure that I only use one app for one database. follow this blog: https://www.percona.com/blog/2007/02/08/debugging-sleeping-connections-with-mysql/ I can tracing the sleep process that it come from my app, it not come from the package. It come from the normal api . But in my laravel code, I do not have any custom code to keep the connection running long time.

Activity icon

Started a new Conversation Does Laravel Disconnect To Database After Each Query?

I check on DB by command: show full processlist and see some sleep process. I read some blog and they said laravel and php always disconect DB after finish query. But in my DB still have some long time sleep process .

https://gyazo.com/38c4c3765b00a1a87455e4c57f35e782

I know that I can set wait_timeout to reduce the sleep connection. But my question is : Why laravel doesn't disconnect after each query Please give me the answer . Thank you so much !

Sep
18
5 months ago
Activity icon

Replied to Get Array Keys Php/ Laravel

Thank ! That may my stupid question :(

Activity icon

Started a new Conversation Get Array Keys Php/ Laravel

I have an array:

array:2 [
  "date" => "2020-01-19"
  "user_id" => 123
]

I would like to get the array keys only, like that:

['date', `user_id`]

I tried to use array_keys php but it's not my expected It return :

array:2 [
  0 => "date"
  1 => "user_id"
]

I also tried to use collection on laravel

$collection = collect(["date" => "2020-01-19",
  "user_id" => 123
  ]);

$keys = $collection->keys();

return $keys->all();

Result:

array:2 [▼
  0 => "date"
  1 => "user_id"
]

althought the laravel document wrote an example:

$collection = collect([
    'prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],
    'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],
]);

$keys = $collection->keys();

$keys->all();

// ['prod-100', 'prod-200']

Can anybody help to exlain to me how to get

['date', `user_id`]

any response is appreciated !