iamvinny

iamvinny

Member Since 2 Years Ago

Ilhabela, SP

Experience Points 3,150
Experience Level 1

1,850 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 27
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

12 Apr
1 week ago

iamvinny left a reply on [PT-BR] Melhor Sistema Para Pagamentos No BR

This is an english community, please look for communities about this subject in your local language.

11 Apr
1 week ago
10 Apr
1 week ago
08 Apr
2 weeks ago

iamvinny started a new conversation How Can I Use Pusher Echo With SharedWorkers?

I'm trying to keep only one connection active per users who open multiple tabs on my application that uses Pusher with Laravel Echo, the example project below works just fine.

https://github.com/pusher-community/pusher-with-shared-workers

But I'm having a hard time trying to adapt it to work with my Laravel project, how should I do it?

14 Jun
1 year ago

iamvinny left a reply on Where Are You All From?

Ilhabela, SP, Brazil.

12 Jun
1 year ago

iamvinny left a reply on How To Get Sum Of Two Different Columns With Laravel Query Builder?

Thanks, but I ended doing something different with eloquent.

$stats = users_stats::where('id', 7)
                ->value(DB::raw("SUM(logins_sun + logins_mon)"));

iamvinny left a reply on How To Redirect To Post Page After Submit

Try using ```insertGetId ``

https://laravel.com/docs/5.4/queries#inserts

And then do something like this:

return redirect("/posts/$id")

iamvinny started a new conversation How To Get Sum Of Two Different Columns With Laravel Query Builder?

I'm trying to get the sum of two different columns using Laravel query builder, the plain SQL Query below works just fine, but I can't get it to work with the Laravel Query.

SELECT SUM(logins_sun + logins_mon) FROM users_stats WHERE id = 7; // returns: 1034

Here's what I have tried. $stats = DB::table('users_stats')->where('id', '=', '7')->sum('logins_sun', '+', 'logins_mon'); // returns: 587.0

And here is my DB structure.

+----+------------+------------+
| id | logins_sun | logins_mon |
+----+------------+------------+
|  7 |     587    |     447    |
+----+------------+------------+

It was supposed to return 1034 but the Laravel Query is returning only the last value 587.0 .

How can I get it working?

27 Feb
2 years ago

iamvinny left a reply on How To Change Default Failed Login Attempts And Lockout Time In Laravel 5.4.12?

Thank you, it worked, I had to put use Illuminate\Http\Request; in the LoginController in order for it to work.

iamvinny started a new conversation How To Change Default Failed Login Attempts And Lockout Time In Laravel 5.4.12?

I'm trying to change the default lockout time and number of attempts before blocking the user. I want to increase the lockout time to 600 seconds and decrease the attempts to 3, how can I achieve this?

26 Feb
2 years ago

iamvinny left a reply on How To Update A Column When The User Successful Login?

I got it working by adding this code to my LoginController.php.

public function authenticated()
    {
        if(Auth::check()) {
             DB::table('users')
              ->where('id', Auth::id())
              ->update(['lastlogin' => Carbon::now()]);

        }    
    }

iamvinny started a new conversation How To Update A Column When The User Successful Login?

I'm trying to update the last login column when the user successful login, I tried putting the code below in LoginController, but it didn't work, I've tried making a listener too, but it didn't work.

$current_time = Carbon::now()->toDateTimeString(); // get current timestamp.

        DB::table('users')
              ->where('id', Auth::id())
              ->update(['lastlogin' => $current_time]);

How can I get it working?

25 Feb
2 years ago

iamvinny left a reply on Keep Getting Unknown Or Bad Timezone From Carbon.

Thanks, @Snapey, it worked exactly the way I wanted, I wanted to say timestamp there, my bad.

iamvinny left a reply on Keep Getting Unknown Or Bad Timezone From Carbon.

Now I'm getting:

Call to a member function addMonths() on string

iamvinny left a reply on Keep Getting Unknown Or Bad Timezone From Carbon.

It's a default UNIX Timestamp.

"2017-02-25 14:25:24"

iamvinny left a reply on Keep Getting Unknown Or Bad Timezone From Carbon.

No luck, still getting the same error. :/

Unknown or bad timezone (2017-02-25 14:25:24)

iamvinny left a reply on Keep Getting Unknown Or Bad Timezone From Carbon.

I tried your code, I got it:

FatalThrowableError in PostsController.php line 131:
Call to a member function addMonths() on string

Setting the newDate like this: $newDate = Carbon::now($expires)->addHours(2);

returns the Unknown or bad timezone error.

iamvinny left a reply on Keep Getting Unknown Or Bad Timezone From Carbon.

@vapenation , If I use 'America/Brasilia' I get an error in my view.

Notice:  date_default_timezone_set(): Timezone ID 'America/Brasilia' is invalid in /Users/vinny/Sites/cubetechnology/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 48

iamvinny left a reply on Keep Getting Unknown Or Bad Timezone From Carbon.

@vipin93 , I got this: "America/Sao_Paulo"

iamvinny started a new conversation Keep Getting Unknown Or Bad Timezone From Carbon.

I'm trying to add 2 months to a date with Carbon, but I keep getting this error:

InvalidArgumentException in Carbon.php line 252: Unknown or bad timezone (2017-02-25 14:25:24)

Here is my code:

`<?php

public function giveMonths(Request $request)

{   

    $query = DB::table('users')->where('level', '=', 2)->get();

    foreach ($query as $row) {

        $id = $row->id;
        
        $expires = $row->expires;

        $newDate = Carbon::now($expires)->addMonths(2);

        dd($newDate);

    }`

In "app.php" the timezone is set this way:

'timezone' => 'America/Sao_Paulo'

How can I solve this problem? Any tip will be appreciated.

23 Feb
2 years ago

iamvinny left a reply on How To Use If Inside Update Query?

Thank you! It worked perfectly. :D

iamvinny started a new conversation How To Use If Inside Update Query?

i'm trying to use if inside a Laravel update query, but it's . not working, here's what I've tried.

$id = request('id');

    DB::table('users')
        ->where('id', $id)
        ->update(['username' => request('username'),
                'name' => request('name'),
                'email' => request('email'),

                if (!is_null(request('password'))) {
                    'password' => request('password'),
                }

                'phone' => request('phone'),

]);

How can I get it working?

iamvinny left a reply on Using Auth In Service Provider To Get User Object

I'm having this problem too, can't get if user is logged in the AppServiceProvider.php. :(