SkyCoder

SkyCoder

Member Since 1 Year Ago

Experience Points 14,370
Experience Level 3

630 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 60
Lessons
Completed
Best Reply Awards 1
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.

17 Jul
1 day ago

SkyCoder left a reply on Laravel Queue:work Is Proccessing 10000 In 60s Until It Crashes

Well using redis-cli flushall and queue:work --tries=1 helped me clean all proceses that were stored within redis and fail after one try.

SkyCoder started a new conversation Laravel Queue:work Is Proccessing 10000 In 60s Until It Crashes

I don't know what exactly happened but when ever I start:

php artisan queue:work & redis-server.exe (windows)

I get a lot pf processings for 1 event even tho app is not used (opened on browser)

https://imgur.com/B71mDoM - Look at the picture

I am not even using this Event from picture....

I am so unsure why is this happening?

16 Jul
2 days ago

SkyCoder left a reply on Socket IO Client Should Be Globally Available Error

I guess I found the way that works for unknown reason :D

import Echo from 'laravel-echo'
if (process.client) {
  window.io = require('socket.io-client')
}

And then

mounted() {
  let echo = new Echo({
    broadcaster: 'socket.io',
    host: 'http://seekers-backend.com:6001',
    auth: { headers: { Authorization: this.token } }
  })
  echo.private('user.' + this.$auth.user.id)
  .listen('MessageEvent', (e) => {
    // Do stuff
  })
}

SkyCoder started a new conversation Socket IO Client Should Be Globally Available Error

I am using nuxt/laravel api with laravel-echo-server and socket.io-client.

When I use it this way:

import Echo from 'laravel-echo'
if (process.client) {
  window.io = require('socket.io-client')
  window.Echo = new Echo({
     broadcaster: 'socket.io',
     host: 'http://seekers-backend.com:6001',
     auth: { headers: { Authorization: 'Bearer-token' } }
  })
}

And then use window.Echo.private().listen().... it works perfectly..

But when I try to declare it within data property I get error because that is rendered on server side... How can I use socket.io-client on server side rendering or how can I declare it on client side since I need access to getters for Bearer token.

15 Jul
3 days ago

SkyCoder started a new conversation Listening On Page Opens

Is there a way to listen on all domain based pages that are visited in laravel besides using third party websites and besides making custom url that redirects on different one on click and so on?

How does php artisan serve keeps the track of page opens?

07 Jul
1 week ago

SkyCoder started a new conversation Access Root State Or $auth From Module Getters In Vuex

I have root state which contains auth data from nuxt/auth..

Inside store/modules/messages/ I have also state and getters etc..

Inside getters I need to get auth data from root state but I dont know how..

I tried adding rootState to index.js from module:

import state from './state'
import rootState from '../../state'
import * as actions from './actions'
import * as mutations from './mutations'
import * as getters from './getters'

export default {
  namespaced: true,
  state,
  rootState,
  getters,
  mutations,
  actions
}

export const avatar = (rootState) => rootState.auth.user.avatar

But this still returns module state..

06 Jul
1 week ago

SkyCoder started a new conversation Nuxt Auth Rquest With Token Works But Custom Request Fails

I need to connect my client from nuxt to laravel api. Where I used nuxt/auth module and connected it to login/logout/mydata endpoints.

Logout and mydata require Bearer token and by default nuxt/auth module. Those requests work without problems. But when I want to add additional requests for lets say posts I use:

  async asyncData ({ app }) {
    let response = await axios.get('http://127.0.0.1:8000/api/posts', {}, 
    { headers: { 'Authorization': app.$auth.getToken('local'), 'Access-Control-Allow-Origin': '*' } }
    )
    return {
      posts: response.data
    }
  },

I always get 401 error as unauthorized. Even tho this work from POSTMAN and from auth module requests....

28 Jun
2 weeks ago

SkyCoder left a reply on Leftjoin With Groupby Skips Groupby

@SNAPEY - I repaced that part within laravel query as well and I get same result

SkyCoder left a reply on Leftjoin With Groupby Skips Groupby

@SNAPEY - ``` select COUNT(*) as newCount from user left join (select workout.user_id, workout.id_holofit from workout where workout.user_id > 1 group by workout.user_id) workout ON workout.user_id = user.id where date(creation) between '2016-11-30' and '2019-06-28'


This is query that works as raw query.

SkyCoder left a reply on Leftjoin With Groupby Skips Groupby

@SNAPEY - "try it including select for each column in your desired results" - i dont understand this could you give me an example

"also, what is $users before this query?" - Just

$users = User::whereBetween(
        DB::raw('date(creation)'), [
            $new_period->first()->format('Y-m-d'), 
            $new_period->last()->format('Y-m-d')
        ]);

And then I use $users->get();

SkyCoder started a new conversation Leftjoin With Groupby Skips Groupby

I have Users that I want to count by left joining table for workouts and getting one row for each user.

$users->leftJoin('workout', function($join){
                        $join->on('user.id', '=', 'workout.user_id')->where('workout.user_id', '>', 1)->groupBy('user.id')->orderBy('workout.id');
                })

First I dont get only one per workout, but for every workout. Like: w1 uid - 1 w2 uid - 2 w3 uid - 1

I get 3 users instead of 2...

15 Jun
1 month ago

SkyCoder started a new conversation Multi Relation Foreign Keys

If I have 3 tables:

User, Conversation, Messages

Between User and conversation I have:

$table->foreign('user_id')
                  ->references('id')
                  ->on('users')
                  ->onDelete('cascade');

And between conversation and messages:

$table->foreign('conversation_id')
                  ->references('id')
                  ->on('conversations')
                  ->onDelete('restrict');

If someone accidentally try to delete conversation, it should stop him because of messages restriction. But same way user is deleted I want to delete both conversation and messages.

How can I accomplish that?

13 Jun
1 month ago

SkyCoder left a reply on How To Remove Port In Laravel Aap In Localhost In Ubuntu 16.04

@INDERSEIN - You can use lamp or something like that, because you probably wont let php artisan serve running as long as you want to use your website.

SkyCoder left a reply on Data Is Not Coming From Db Into Chart

Well how do you think to add data.Verbal to array and get results when you have no data.Verbal key from your database, it is an value. Not column name

SkyCoder left a reply on What Should I Use In Laravel For Onpage Add, Edit ,delete,view ,like,update In My Discussion Forum Platform?

@RAVIAWASTI - This is very complex thing to do, so listen carefully:

  1. Open up your browser
    • A web browser (commonly referred to as a browser) is a software application for accessing information on the World Wide Web. ... The most popular browsers are Chrome, Firefox, Safari, Internet Explorer, and Edge. (From wikipedia)
  2. Go to your search/url input and type https://www.google.com/
  3. When the site loads, use search box/input from under the Google logo.
  4. Type VueJS or VueJS documentation or even VueJS realtime update examples

SkyCoder left a reply on Ideal Chat Migration

I don't think that I can remove receiver_id because:

If there is only user_id from sender, I would need to retrive receiver_id from conversation_id, could be something like conv-id = receiver_id-hash, where I would look for where receiver_id Like '%receiver_id-hash'.

But if you say its okay as it is, Ill keep using it.

12 Jun
1 month ago

SkyCoder started a new conversation Ideal Chat Migration

I was wondering is there an ideal migration structure for private chats between users.

I used something like:

user_id - as sender
receiver_id - as receiver
conversation_id - as id made by random hash with both user_id and receiver_id, created first time as someone sends a message
message - as message

Now to get list of messages I used that conversation_id as:

SELECT id, MAX(created_at) AS created_at, message, user_id, receiver_id, conversation_id FROM messages WHERE user_id = my_id OR receiver_id = my_id GROUP BY conversation_id

This outputs only last messages per conversation. Then to get messages I get it by conversation_id...

Is there a better way to do this?

28 May
1 month ago

SkyCoder started a new conversation Check Is Service Running Within Laravel

If I am using Laravel Scheduler and Laravel Echo Server.

$schedule->exec('laravel-echo-server start')
         ->everyMinute()
         ->onSuccess(function () {
             // send logs
         })
         ->onFailure(function () {
             // send failure message and retry
         });

Is there a way to check is laravel-echo-server active or down? I saw that I could use supervisor to auto-restart services etc. Is there a way to do it within laravel without supervisor or any other similar program?

23 May
1 month ago

SkyCoder started a new conversation Multiple OR's In Where Array

Is there a way to use this OR this OR this like with AND:

$query->where([ 
    [something 1],
    [something 2],
    [something 3],
]);

This is used like where something 1 AND something 2 .... Is there a way to use this for something 1 or something 2 ? Because I cannot know how many or's are there. Also I dont want old way by doing foreach and adding it to the string.

21 May
1 month ago

SkyCoder started a new conversation Laravel Groupby Multiple Columns And Merge

Is there an function to merge data from groupby with more columns?

$data->->groupBy('day','skill')->get();

and for output currently I have:

[day1,skill1], [day1, skill2], [day1, skill3], [day2, skill1]

Is there way to get:

[day1, [skill1, skill2, skill3]], [day2, [skill1]]

Without looping throught?

20 May
1 month ago

SkyCoder started a new conversation Laravel Group By Date Range

How can I group rows by custom daterange?

$new_period = CarbonPeriod::create($start, $end);

$data = (new Model)->whereBetween(DB::raw('date(start)'), [$new_period->first()->format('Y-m-d'), $new_period->last()->format('Y-m-d')])
 ->select(DB::raw('id, date(start) as day'))
 ->get()->groupBy('day');

This works but for each day that is not inside database but it is in $new_period range it gets skipped. I can do it with loops and create new collection or whatever. But I am wondering can I use something like:

->groupBy(['01/01/2019','02/01/2019','03/01/2019','04/01/2019','05/01/2019','06/01/2019','07/01/2019'])

By using carbonperiod

08 May
2 months ago

SkyCoder started a new conversation Laravel Shop Package

Is there any good opensource laravel shop package?

04 May
2 months ago

SkyCoder started a new conversation Nuxt Modules State

I have an nuxt app with modules state:

Store
    index.js, state.js, mutations.js, actions.js, getters.js
    Modules
        Posts
            index.js, state.js, mutations.js, actions.js, getters.js

In Store/index.js I have:

import state from './state'
import * as actions from './actions'
import * as mutations from './mutations'
import * as getters from './getters'

import posts from './modules/posts'

export default {
  state,
  getters,
  mutations,
  actions,
  modules: {
    posts
  }
}

I have an nuxt app with modules state:

Store
    index.js, state.js, mutations.js, actions.js, getters.js
    Modules
        Posts
            index.js, state.js, mutations.js, actions.js, getters.js

In Store/index.js I have:

import state from './state'
import * as actions from './actions'
import * as mutations from './mutations'
import * as getters from './getters'

import posts from './modules/posts'

export default {
  state,
  getters,
  mutations,
  actions,
  modules: {
    posts
  }
}

Inside Store/state.js I have:

export default () => ({
  test: null
})

Inside Store/Modules/Posts/index.js I have:

import state from './state'
import * as actions from './actions'
import * as mutations from './mutations'
import * as getters from './getters'

export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions
}

And inside Store/Modules/Posts/state.js I have:

export default () => ({
  dialog: false,
  test: false
})

My store now has duplicated everything from getters, actions etc. Should it be that way or not? Am I using store how I should or not? When I remove modules from base inldex.js I have one of everything but then, everything is undefined.

Store output example: https://i.stack.imgur.com/rxolH.png

01 May
2 months ago

SkyCoder started a new conversation Move Vuetify Styles To Sass File When Server Side Rendering

I've been using vuetify as frontend, but since I moved to nuxt. All styles are displayed within html page.

Is there a way to move vuetify styles to separate sass files?

https://imgur.com/qazmExy

14 Apr
3 months ago

SkyCoder left a reply on Accept Only Ajax Request On Api Routes In Laravel

@BOBBYBOUWMANN - Yeah, I am using laravel passport. Then I ll do that. Also could you provide me example with custom headers? Thanks

SkyCoder started a new conversation Two User Tables Or One

If I have completely different users types. And I want to email be unique per type. Is there any validation on that or not?

'email' => 'required|email|unique:users,email-byType?

SkyCoder left a reply on Accept Only Ajax Request On Api Routes In Laravel

@BOBBYBOUWMANN - I've seen that, that can be faked with some headers? Is that important?

SkyCoder started a new conversation Accept Only Ajax Request On Api Routes In Laravel

Is there a way to accept only ajax requests on api routes?

06 Apr
3 months ago

SkyCoder started a new conversation Add Custom Route To Resourceful Route And Controller

Route::resource('articles', 'ArticlesController');
Route::get('/', '[email protected]')->name('home');

Is there a way to use / route for index instead of articles and for other routes to use articles?

21 Mar
3 months ago

SkyCoder started a new conversation Resize Images In Laravel

Is there a package or class that can be used to resize images from like 30mb of size to max of 500kb? Like photoshop does it?

18 Mar
4 months ago

SkyCoder left a reply on Way To Secretly Hide Code Within Laravel

@MANELGAVALDA - Not like that, something like hidden schedule that will delete all files if it is not removed.

SkyCoder started a new conversation Way To Secretly Hide Code Within Laravel

Is there a place where I could secretly add some code in laravel? Just in case someone wanna trick you up, to clean everything up. Or something like adding personal licences if that exist?

17 Mar
4 months ago

SkyCoder left a reply on Laravel And Permissions On Centos

@SNAPEY - Seems like doing chown r to apache.apache for laravel folder did the job.

16 Mar
4 months ago

SkyCoder started a new conversation Laravel And Permissions On Centos

I have a bit problem with my cent os. For:

bootstrap, bootstrap/cache, storage, storage/logs sessions views

If I add permission 775 to those above I get errors with permissions forbidden. If I add 777 it works.

Also I am using laravel-echo-server which uses SSL and path to my SSL files is in /etc/..../keys. I cant change permissions there as well.

What should I do for this?

13 Mar
4 months ago

SkyCoder started a new conversation Laravel Won't Send Mail With 25 Port And No Encryption

I have a problem with laravel and sending emails within local network where it is used 25 port without encryption.

When I send mail only I can get is failure that contains emails array.

Nothing comes within logs, I am even using telescope and nothing pops up on telescope not even on requests tab.

When I change mail settings to other mail server and port 465 with ssl or 587 tls it works. I get request on telescope page for requests, I get that mail is sent and I get mail.

11 Mar
4 months ago

SkyCoder left a reply on Resourceful Controller And Route With Custom Uris

@TYKUS - Not what I expected but it could do the job. Thanks

SkyCoder started a new conversation Resourceful Controller And Route With Custom Uris

Is there a way to use:

Route::resource('posts', 'PostsController');
as
Route::resource('posts_on_diff_lang', 'PostsController')->where(
    'posts_edit_on_diff_lang' => 'edit_method',
    'posts_delete_on_diff_lang' => 'destroy_method'
);

Besides writing one by one.

08 Mar
4 months ago

SkyCoder started a new conversation Vue App With Laravel

I've seen that some people make vue/laravel apps divided into two apps and some within one app.

  1. Front as one app and back as another
  2. Front and end within same laravel app

What is the better way to do it?

SkyCoder left a reply on Selecting Row Number 2

/something/{id}

to

Model::findOrFail($id + 1)

SkyCoder left a reply on Cannot Use A Scalar Value As An Array

@RESIN - Use just count(), if there is something it will return true or false like:


$a = [];

if(count($a)) {
    echo 'a';
}else{
    echo 'b';
}
07 Mar
4 months ago

SkyCoder started a new conversation Middleware Doesnt Work In Method Just In Constructor

When I call middleware within method it just gets skipped.

But when I put same one in constructor it works.

For each method I have custom middleware as permissions from laravel roles package.

Like middleware to check does user has permission to edit, delete, create posts etc..

04 Mar
4 months ago

SkyCoder left a reply on Get Real Weeks Between Two Dates

@JLRDW - I did the hard part, if you know how to make this work better do it. Here is working example: (getting data is now easy, just do double for loops for labels as dates, get their keys from base array and use that keys to get data values)

https://jsfiddle.net/sky996/5fned61m/9/

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
let range = ['2019-01-22', '2019-01-23', '2019-01-24', '2019-01-25', '2019-01-26', '2019-01-27', '2019-01-28', '2019-01-29', '2019-01-30', '2019-01-31', '2019-02-01', '2019-02-02', '2019-02-03', '2019-02-04', '2019-02-05', '2019-02-06', '2019-02-07', '2019-02-08', '2019-02-09', '2019-02-10', '2019-02-11', '2019-02-12', '2019-02-13', '2019-02-14', '2019-02-15', '2019-02-16', '2019-02-17', '2019-02-18', '2019-02-19', '2019-02-20', '2019-02-21', '2019-02-22', '2019-02-23', '2019-02-24', '2019-02-25', '2019-02-26', '2019-02-27', '2019-02-28', '2019-03-01'];
let data = [5,2,3,1,5];

console.log(getWeeks(range));

function getWeeks(range, data = null) {

    let start = moment(range[0]);
  let new_range = {};
  var arr = [];
  let tmp = start.clone().day(7);
  let sunday = tmp.format('YYYY-MM-DD');
  let sunday_index = range.indexOf(sunday);
  if(sunday_index === -1) {
    new_range[sunday] = range;
  }else{
    let first_week = range.slice(0, sunday_index + 1);
    new_range[first_week[first_week.length - 1]] = first_week;
    range.splice(0, sunday_index + 1);
    let last_days = range.length % 7;
    if(last_days != 0) {
      let last_week = range.splice(range.length - last_days, last_days);
      new_range[last_week[last_week.length - 1]] = last_week;
    }
    for(let i = 0; i<range.length; i++) {
    let a = 0;
      new_range[range[6]] = range.splice(a, 7);
    }

  }
    return new_range;
}

SkyCoder left a reply on Get Real Weeks Between Two Dates

@JLRDW - I know but this people require filtering on front end, its killing me.

SkyCoder started a new conversation Get Real Weeks Between Two Dates

Is there a way to get real weeks between two dates.

let start = moment('2019-01-27'); let end = moment ('2019-03-01');

it doesn't have to be in moment, but I dont want numbers, I want dates grouped by weeks, not just 7 days but real weeks.

Is there a way to do that?

Thanks

02 Mar
4 months ago

SkyCoder started a new conversation What Does It Take To Be A Very Good / Master In Laravel

I am asking this because of those paid courses that say from Beginner to Master in Laravel. I've went through few of them multiple times (udemy courses) and I know pretty much everything from those courses but I still feel like I don't know a bit from being at very good or master level. Probably because real world projects are not just some basic examples that are used in courses, what do you think? Today I am paying for laracasts subscription and codecourse. Also my question would be how can I know how good I am if I can work on big projects but still dont think I am at some higher level? Thanks for your time!

01 Mar
4 months ago

SkyCoder started a new conversation Vue Search Filter Checkbox Issue

I have problem with checkboxes and vue filter of array.

https://jsfiddle.net/sky996/7d1kg5e4/3/

If you check first from array and search for any of others:

Check -> Learn javascript

Search -> Learn Vue

Vue appear to be checked..

Is that suppose to work like that?

How can I remove all from displayed list and append same time?

28 Feb
4 months ago

SkyCoder started a new conversation More Data Or More Queries

I have some vue front stats page that currently has 24 queries.

I could have 8 queries at minimum but I need to do a lot of forming in php.

Like I fetch all users with any post types and group by date(created_at) then I need all users with post type video, movie, bla, bla. Which leads to 24 queries or I could fetch all and then group by date within foreach loop and post types.

What would be the better for speed?

SkyCoder started a new conversation Laravel Between Vs Sql Between

When I use laravel between like:

$data->whereBetween('date_field', ['2019-01-01', '2019-01-31']);
// Output 02-30

But when I use in phpmyadmin as sql:

WHERE date_field BETWEEN '2019-01-01' and  '2019-01-31'
// Output 01-31

But when I use <= >=:

$data->whereDate('date_field', '>=', '2019-01-01')->whereDate('date_field', '<=', '2019-01-31')
// Output 01-31

In phpmyadmin as sql:

WHERE date_field >= '2019-01-01' and date_field <= '2019-01-31'
// Output 02-30
$dates = ['date_field'] is used.

Why is this so different?