SkyCoder

SkyCoder

Member Since 1 Year Ago

Experience Points
16,450
Total
Experience

3,550 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
65
Lessons
Completed
Best Reply Awards
2
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

Level 4
16,450 XP
Jan
09
2 weeks ago
Activity icon

Started a new Conversation How To Publish Views And Group Routes From Jeremykenedy/laravel-roles

How to publish views and group routes from jeremykenedy/laravel-roles ?

Also seems like I need to change every trans() to __() in laravel 6? Why isn't it working like this: trans_choice('laravelroles::laravelroles.cards.users-count', count($item['users']), ['count' => count($item['users'])]) as it comes within package?

Dec
26
4 weeks ago
Activity icon

Awarded Best Reply on How To Bind Multiple Style With Array In Vue.js

Did you try 'border-top': '5px solid ' + item.cardColor?

Activity icon

Replied to How To Bind Multiple Style With Array In Vue.js

Did you try 'border-top': '5px solid ' + item.cardColor?

Activity icon

Started a new Conversation Update Relations With Relation Data

How could I do this without foreach or each?

foreach($user->posts as $post) {
    $post->update(['name' => $post->name . ' - test']);
}

$user->posts()->each(function($post) {
    $post->update(['name' => $post->name . ' - test']);
});

I was thinking something like:

$user->posts()->update(['name' => 'HOW COULD I ACCESS EACH VALUE FROM COLLECTION?']);

I could use:

DB::raw("UPDATE posts SET name = name + ' - test' WHERE id = userID ")

But is there any direct way from relation?

Dec
04
1 month ago
Activity icon

Replied to Make Collection From First/find/get

Now I clicked on the best answer on purpose :D

Activity icon

Replied to Make Collection From First/find/get

I didn't want to give you the best answer I clicked wrongly but your doesn't work if I pass collection, it just adds collection into collection

Activity icon

Started a new Conversation Make Collection From First/find/get

How could I make collection from first/find as in get?

public function send($notification, $users) {
      collect($users)->each(function ($user) use ($notification) {});
}

If I pass ->send([], App\User::first()) every field turrns into collection, I would like to push that one within new collection or if I pass collection just to use it as it is.

How can I do that?

Nov
22
2 months ago
Activity icon

Started a new Conversation Laravel Vs Lumen For API

Which one should be used for big API apps?

Oct
29
2 months ago
Activity icon

Started a new Conversation Removing Duplicates From Mysql Table With Email Column

I have table with 20k rows that contains some emails and I would like to remove all duplicates.

I tried these:

delete from users using users, users e1 where users.id > e1.id and users.email = e1.email

DELETE FROM users WHERE id NOT IN (SELECT MIN(id) FROM users GROUP BY email)

DELETE e.*
FROM users e
WHERE id IN
 (SELECT id
   FROM (SELECT MIN(id) as id
          FROM users e2
          GROUP BY email
          HAVING COUNT(*) > 1) x);

None of these work, I still have duplicates...

Any ideas?

Oct
18
3 months ago
Activity icon

Started a new Conversation Is There A Way To Extend Env

Is there a way to extend env helper to accept param as env filename with env folder of env files? Case of usage:

I am creating package where I would like to give users full control with models, controllers... Like my package env and config have:

models>modelname>pathToModel::class routes>routeName>routePath etc...

Since config will publish automatically, if they update config will be new.. So I would like to have env file for only my package routes, middlewares, models etc..

So is there a way to make env folder and put env files within it. Where by using env helper to pass path to file for env reading

Oct
17
3 months ago
Activity icon

Replied to Extending Package.json Within Laravel Package

Well I am creating chat app that could be added to any projects that contains users table, with some additional tables. In that case I would do it with just components etc and then add it as option to use chat component if they want or just endpoints for custom frontend.

Oct
16
3 months ago
Activity icon

Started a new Conversation Extending Package.json Within Laravel Package

I am making some laravel package that would use vue.js, vuex and router. How can I include those from laravel package?

Do I need to change webpack.mix as well as app root package.json or is there some quicker way that doesn't require someone to manually install required packages?

Oct
14
3 months ago
Activity icon

Started a new Conversation How T Check Is Param Collection Or Object

I created custom notifications model with two params, notification and user/users. I tried to check if it is object or collection but it always returns as object.

public function send($notification, $users) {
        if(!is_null($users) && is_object($users)) {
          $this->create([
              'user_id' => $notification['user_id'],
              'foruser_id' => $users->id,
              'type_id' => $notification['type'],
              'info' => $notification['info'],
          ]);
        } else if(!empty($users)) {
            foreach($users as $user) {
                $this->create([
                    'user_id' => $notification['user_id'],
                    'foruser_id' => $user->id,
                    'type_id' => $notification['type'],
                    'info' => $notification['info'],
                ]);
            }
        }
    }

How can I check if I passed something like:

User::find($id) or User::where('id', '!=', auth()->user()->id)->get()

Sep
24
3 months ago
Activity icon

Started a new Conversation How To Handle Mass Mail Sending With Queue Timeout

I have table with 100K+ emails where I want to daily send some email:

I added schedule in app\Console\Kernel.php:

$schedule->job(new SendDailyEmails)->dailyAt('09:00');

Inside Job I have:

$users = User::all();
foreach($users as $user){
    Maill:to($user->email)->send(new DailyMail($user));
    $status = 'sent';
    if( in_array($user->email, Mail::failures()) ){
        $status = 'failed';
        Log::error($user->email . ' was not sent.');
    }else{
        Log::info($user->email . ' was sent.');
    }
    SentMail::create([
        'email' => $user->email,
        'status' => $status
    ]);
    
}

This works fine, but after some time this stops probably because job timeout. In failed_jobs table I get MaxAttemptsExceededException with message that Job attempted too many times or run too long. Since I set queue tries max to 3 within supervisor it should and do go 3 times only. And by testing things it did not try to attempt again because I got one mail instead of 3.

So it comes to timeout and I am not sure what is default value but does it matter since I will not know how much time it would take to send all emails?

Should I divide mails into groups of 50 and call separate job instances for each group?

Anyone have a good working answer for this?

Aug
12
5 months ago
Activity icon

Started a new Conversation Adding Custom Private Channel For Broadcasting Notification In Laravel

Broadcasting works but it uses notifiable_type as channel name with user id. But what if I want to change only on backend api that some model is within 10 sub folders. I would need to change that channel on frontend everywhere...

From docs I found this:

 /**
     * The channels the user receives notification broadcasts on.
     *
     * @return string
     */
    public function receivesBroadcastNotificationsOn()
    {
        return 'users.'.$this->id;
    }

But it is not working, it is still using notifiable_type as channel name.. How can I change this?

Aug
11
5 months ago
Activity icon

Replied to Watching For Div Width Changes In Vue

Yeah, I found this as minimal possible code package: https://github.com/Kelin2025/vue-responsive-components

Activity icon

Started a new Conversation Watching For Div Width Changes In Vue

I have an nuxt app where I have two sidebars, one on the left and one on the right.

Both are fixed and body has padding from right and left.

In the middle I have that loads pages.

Left sidebar can be minimized to 60px so I cannot use media queries for this and I need to watch for width changes, in case that width is < 500px I would add some other classes. Something like media queries for element instead of viewport.

Is there a way to do this without additional javascript libraries, plugins etc..?

Aug
07
5 months ago
Activity icon

Started a new Conversation How To Properly Use Api Auth With Passport

I am wondering is using auth()->user() usable with passport auth?

Currently I am using attempt method for login and on localhost I had no problem but on server I needed to add to use web instead of api to work with it. Now I am wondering is that right anyway?

Since I don't use session and cookies, when I send bearer token through headers does it directly check within database and then store User within auth()->user() or how does it work?

Aug
04
5 months ago
Activity icon

Started a new Conversation How To Properly Proxy Reverse Apache With Node

I am having nuxt and laravel combo, where I want to use domain-name.com for nuxt. Currently it is working domain-name.com:3000..

Aug
03
5 months ago
Activity icon

Started a new Conversation How To Install Latest Node And Npm On Centos 7

From every examples they use bash command and my brand new centos vps doesnt have bash command...

Jul
30
5 months ago
Activity icon

Replied to How Does Fill Update Work With Password Field

I understood you much clearer :D Will do it :D

Activity icon

Replied to How Does Fill Update Work With Password Field

It is for api, so I dont know how does that works with an api.. Also what if user is already logged in and he wants to change his password? I mean instead of checking for current password I can as well send code to email and then verify but that it different question from mine.

Like mine is validation for all fields for updating and then using all within fill or separately with example from up above :D

Activity icon

Started a new Conversation How Does Fill Update Work With Password Field

If I do

auth()->user()->fill([
  'password' => bcrypt(request('password'))
]);

It will make different hash and store new hash in database as new password since hashes won't match. I know this is not a big deal but should I still use fill or something like:

auth()->user()->password = request()->filled('password') && Hash::check(request('password'), auth()->user()->password) ? request('password') : auth()->user()->password ;
Jul
27
5 months ago
Activity icon

Replied to Get Users With Admin Role From Jeremykenedy/laravel-roles

Seems like I need to use something like this:

jeremykenedy\LaravelRoles\Models\Role::where('name, 'Admin')->first()->users()->has('posts')->get()

Activity icon

Started a new Conversation Get Users With Admin Role From Jeremykenedy/laravel-roles

User::whereHas('roles', function($q){
            $q->hasRole('Admin');
        })->has('posts')->get()

How can I check if rows have Admin role from jeremykenedy/laravel-roles package within query builder?

Activity icon

Started a new Conversation Get Users That Have One Post At Least

How would I get user that has at least one post:

SQL example:

SELECT u.* FROM USERS u WHERE EXISTS(SELECT NULL FROM posts p WHERE p.user_id = u.id)

Laravel resource example:

return [
    'user' => $this->when($this->posts->count(), [
        'name' => $this->name,
        'last_post' => $this->posts->last()
    ])
]

Laravel where exists example:

DB::table('users') ->whereExists(function ($query) { $query->select(DB::raw(1)) ->from('posts') ->whereRaw('post.user_id = users.id'); }) ->get();

Which one of these is better to use

Jul
24
5 months ago
Activity icon

Started a new Conversation When To Use Nuxtserverinit

I have schools page where I have 1500 schools that probably never change.

I want to on each school pages open, make request to api to check is school table updated. If it is I would change data within store and local storage and cookies.

I tried using asyncData() {} that needs to have return, but I am not returning any data but updating state if versions are not the same.

I looked up for nuxtserverinit but I am not sure how it works and when to use it?

Is there a better solution for this?