Elenktik

Elenktik

Member Since 3 Years Ago

Experience Points
20,470
Total
Experience

4,530 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
170
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.

Level 5
20,470 XP
Oct
20
22 hours ago
Activity icon

Replied to How To Refactor Large Repositories?

Yes ofc a singe opinion on the web is not the ultimate truth, just wanted to point out that I have seen such an implementation before. Was just the first hit on google, I have seen more of that.

Also I didn't find any good source for the definition of the repository pattern, if you have one, I would be happy to see it. I found a German wiki entry at https://de.wikipedia.org/wiki/Repository_(Entwurfsmuster) which claimes that it should contain CRUD:

Conceptually, the repository encapsulates the objects persisted by the data access layer and the access to them - regardless of whether they are stored in a database or made available via a web service (or otherwise)

I also found an entry on https://en.wikipedia.org/wiki/Domain-driven_design

Repository: Methods for retrieving domain objects should delegate to a specialized Repository object such that alternative storage implementations may be easily interchanged.

So at least according to Wikipedia and the random dude it seems that storage is part of the repository pattern.

Still thanks for your feedback.

Activity icon

Replied to How To Refactor Large Repositories?

@martinbean Thanks for your respond. I thought the purpose of the repository class is to be a layer between domain and data and therefor it is responsible for all CRUD tasks.

I just googled Laravel repository pattern and the first hit was for example https://asperbrothers.com/blog/implement-repository-pattern-in-laravel/ which defines an EloquentRepositoryInferface by a find and create method:

{
   /**
    * @param array $attributes
    * @return Model
    */
   public function create(array $attributes): Model;

   /**
    * @param $id
    * @return Model
    */
   public function find($id): ?Model;
}

In my case, I have a Tree model and a TreeRepository, so moving tree-related methods in a trait is like moving the complete repository in a train.

So if I understood you right, you would say let the repository just grow as much as it needs? Also, where do you usually put the logic for creating/updating things when you don't put them in a repository?

Activity icon

Started a new Conversation How To Refactor Large Repositories?

I have a repository with 8 methods for create/update calls and 10 methods for retrieving different kind of results. Its a repository for a tree model and the get methods are something like getLeftSubtree getRightSubtree getFullSubtree, getUpline getSponsorUpline, .. things like that.

Now I feel the repository size is too large with its 18 methods. Do you have any recommendations how to refactor this? I am thinking about splitting the create/update and get methods, but I also think they belong in the tree-repository.

Oct
19
1 day ago
Activity icon

Started a new Conversation Value Not Passed As Prop?

I have a prop value disabledMessage and using it like this:

<nie-toggle name="assign_seals" disabledMessage="Here is a message lol..."></nie-toggle> 

In my component I have defined disabledMessage in my props like this:

export default {
  props: {
    type: {
      type: String,
      default: 'is-primary'
    },
    label: '',
    name: '',
    option: '',
    optional: Boolean,
    model: {},
    value: '',
    size: {
      type: String,
      default: 'is-half'
    },
    disabledMessage: {
      type: String,
      default: '',
    }
  },
  methods: { ...

However, when I load the page, disabledMessage in props is empty. But the message ended up in $attrs array. What did I miss?

https://i.stack.imgur.com/qBAru.png

Oct
16
4 days ago
Activity icon

Commented on Extract What Changes Into A Service Provider

Is that the Registry Pattern Jeffrey mentions at 03:06?

Activity icon

Commented on Extract What Changes Into A Service Provider

I would also love to see that. "Registry Pattern Laravel" does not find anything on Google

Oct
15
5 days ago
Activity icon

Commented on PHPStorm's Laravel Facades Issue

Why do you recommend to gitignore it?

Activity icon

Started a new Conversation How To Sync Routes When Refactor Controller With PHPStorm?

If I click on the namespace of a controller and press F6 I can rename the namespace and the controller will be moved into the according directory.

However, this will not update the use of the namespace in the routes routes/web.php file.

For example Route::get('businessdocument/{type}/{country}/{lang}', 'Documents\[email protected]')->where('type', '[0-9]+');

will remain unchanged even if I change the namespace in BusinessDocumentController.

Can I use settings in PHPStorm to automatically update routes?

Oct
14
6 days ago
Activity icon

Replied to How To Move A File In PHPStorm?

GOt it now. If you want to move a folder with its content you have to move the "namespace", if you want to move a class, just click the class name

Activity icon

Replied to How To Move A File In PHPStorm?

@bugsysha how do you move a complete folder? Do you have to go through every file and click on the namespace and then on move?

Activity icon

Replied to How To Move A File In PHPStorm?

Nice! That was it now it work!

Thank you!

Activity icon

Replied to How To Move A File In PHPStorm?

Yes I am just watching that series :D

But these settings are already setup correctly (also including my tests folder). If I create a new class, the correct namespace is shown.

Activity icon

Replied to How To Move A File In PHPStorm?

@automica I have "Search for references" clicked:

enter image description here]1

but when press "Refactor" the file is placed in the new directory, but with the old namespace. Just reading the manual and they they they assume PSR0. However I use PSR-4 - but everyone is using it in 2020 right? :D

Activity icon

Started a new Conversation How To Move A File In PHPStorm?

I have a class that I would like to move.

Using PHPStorm F6 I can select a new directory. However, neither the namespace, nor all files referencing the class are updated. Am I doing something wrong?

Using PHPStorm 2020 EAP

Oct
13
1 week ago
Oct
12
1 week ago
Activity icon

Started a new Conversation How To Couple .vue Data With Blade?

On my Laravel blade I pass computed $data to my blade file. In my blade file, I use a Buefy table to represent the data: https://buefy.org/documentation/table like this:

<b-table :data="{{ convertMultiArrayToJson($data)}}" :columns="columns">
    <template slot="actions" slot-scope="row">
        <b-button @click="edit(row)"> Edit </b-button>
        <b-button @click="delete(row)"> Delete </b-button>
    </template>
</b-table>

This works, but now data is not a global accessible property of my Vue instance. I cannot do something like

<b-field class="column is-full" v-if="data.length>0">
....
</b-field>

because data is only set in the b-table component. Is there a possibility to set the Vue Data property from the blade?

SOmething like this:

<vue-setter data=" {{ convertMultiArrayToJson($data)}}"></vue-setter>

<b-field class="column is-full" v-if="data.length>0">
    <b-table :data="data" :columns="columns">
        <template slot="actions" slot-scope="row">
            <b-button @click="edit(row)"> Edit </b-button>
            <b-button @click="delete(row)"> Delete </b-button>
        </template>
     </b-table>
</b-field>
Oct
06
2 weeks ago
Activity icon

Started a new Conversation PHPUNIT WithSession Fails On CI / CD Pipeline?

All tests from my Laravel application are passing localy. However on my CI/CD pipleline on Gitlab one tests fails that is using withSession:

$response = $this->withSession(['is_admin' => 1])->actingAs($user)->post('/user/my-profile/edit/' . $user->id, $postData);

Any idea what could cause it?

I am using

  <env name="SESSION_DRIVER" value="array"/>

inside phpunit.xml and thats the content of my .gitlab-ci.yml:

test-backoffice:
  stage: test
  image: php:7.4
  services:
      - mysql:5.7
  variables:
    # MYSQL_DATABASE: $BACKOFFICE_TEST_DB
    MYSQL_DATABASE: "backoffice"
    # MYSQL_ROOT_PASSWORD: $BACKOFFICE_TEST_PW
    MYSQL_ROOT_PASSWORD: "test"
  cache:
    paths:
      - vendor/
      - node_modules/
  before_script:
  - apt-get update -yqq
  - apt-get install gnupg -yqq
  - apt-get install libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev libzip-dev -yqq
  - docker-php-ext-install pdo_mysql curl json intl gd xml zip bz2 opcache mysqli
  - pecl install xdebug
  - docker-php-ext-enable xdebug
  - curl -sS https://getcomposer.org/installer | php
  - php composer.phar config gitlab-token.gitlab.com ${GITLAB_TOKEN}
  - php composer.phar install
  - php composer.phar dump-autoload
  - export DB_HOST=mysql
  - export DB_DATABASE_TEST=backoffice
  - export DB_USERNAME=root
  - export DB_PASSWORD=test
  - export DB_CONNECTION=testing
  - export APP_ENV=local
  - export APP_KEY="base64:dxGYMvIIqBi8DzCXR5/+2aOTl7e099ZKjrIvND7cJ1A="
  # - php artisan config:cache TODO: try without 
  - php artisan testdb:migrate
  script:
    - php vendor/bin/phpunit --colors=never
Sep
07
1 month ago
Activity icon

Replied to Laravel : Return Json Data From An Array

If you return an array in Laravel it is parsed into Json by default. No need to call return response()->json($data); just do return $data

Aug
30
1 month ago
Activity icon

Replied to How To Prevent Artisan Command From Killing My System?

So on the working server I have the same Laravel application and the queue worker is only run on the workingserver? Sounds like a good solution, however this 5h command does only need to run one single time, then never again.

Activity icon

Started a new Conversation How To Prevent Artisan Command From Killing My System?

I have an artisan command that I need to exectue on my live server. It takes about 5 hours. How can I run this command, without using all system resources (CPU/Memory)? I don't care if it even takes a week, I just want to make sure its not using 100% of my system resources (it creates a lot of mysql queries). Its also possible to split the command in many jobs, but then I still don't know how to tell the jobs not ot use 100%. Is there any solution for this kind of issue?

Aug
26
1 month ago
Activity icon

Replied to Run Migrate In Dockerfile?

@sinnbeck sorry maybe I am blind, but I am not quite sure how this relates to my question.

I am just wondering, why I have never seen a single tutorial where stuff like

mv .env.example .env
php artisan generate
php artisan migrate
composer install

was put in the dockerfile for local development. Would it not make sense, because its usually only build once?

Aug
25
1 month ago
Activity icon

Started a new Conversation Run Migrate In Dockerfile?

I have setup a docker-compose that starts a database, a nginx server and my php-app for local development. After starting the container for the first time, I have to ssh in the php-app container and in there I run all the commands that I need to run after an initial setup like php artisan generate , mv .env.example .env, php artisan migrate, composer install etc.

Now I wonder - would it not make sense to put these commands in the Dockerfile? Or does this cause any issues? I have never seen that people wrote these initial commands in the Dockerfile (Tutorials that I watched/read where https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose, https://www.youtube.com/watch?v=5N6gTVCG_rw and https://www.youtube.com/watch?v=0HTruhilvcU )

Aug
24
1 month ago
Activity icon

Started a new Conversation How To Pass Date From Buefy To Laravel?

I am using the Buefy datepicker to let users pick a date at the front end (https://buefy.org/documentation/datepicker).

When I submit the form through axios, the date is a string of this form:

"Mon Aug 03 2020 00:00:00 GMT+0200 (Central European Summer Time)".

In order to save this in a timestamp mysql column, I need to remove the content in the brackets and use the following code to parse it to a string like this: "2020/08/03"

$cleanDate   = preg_replace('/\(.*\)/', '', $request->start);
$timestamp = strtotime($cleanDate);
$start            = date('Y/m/d', $timestamp); 

Is this how you do it, if oyu use a Vue datepicker? It feels so clumsy to me.

Jul
25
2 months ago
Activity icon

Replied to Restart Supervisor During Deploy?

How do you restart supervisor?

Activity icon

Commented on Dispatch Your First Job

would love to hear that aswell.

Jul
19
3 months ago
Activity icon

Started a new Conversation Wish: Lumen Series

There is one introduction video for Lumen on this platform here: https://laracasts.com/lessons/introducing-lumen, however, its a rather short introduction and its from 2015.

The top comment with 20 hearts says this:

Could you please create one course of Lumen? In this course we want to know how to create microservices and > how to use these microservices in the application. Please create this course asap. Thank you.

I really would loved to see how one extracts something out of a Laravel-Appliation into a Lumen-Application and how to interact with these services. I think there is a high demand for such a video serious.

BTW: Is Feedback the right channel for video-wishes? Or should it be in the channel Request?

Jul
09
3 months ago
Activity icon

Started a new Conversation Vue Form With File Uploads?

I am using the form object approach from https://laracasts.com/series/learn-vue-2-step-by-step/episodes/19

However, I also have file uploads in my form. Instead of data.set(field, this[field]); I need to call something like data.append('coverImage', this.cover); or

   if(this.images.length > 0){
      this.images.forEach(function(image){
        data.append('gallery[]', image);
      });
    }

Any ideas how to modify form so it can handle also file uploads?

Only idea that I had was to modify the form object:

 new Form({ 
  data: {
    title: '',
    name: ''
   _method: '',	  
},
  files: {
  cover: null,
  images: [],
 }
  });

and then to access everything to form.data.title or form.files.cover etc.

But not sure if this is the best way.

Activity icon

Commented on Object-Oriented Forms: Part 1

The part where Jeffrey uses @keydown to delete an entry with delete this.errors[field] will not update the dom in Vue2. Instead one has to use Vue.delete(this.erros,field). See https://vuejs.org/2016/02/06/common-gotchas/

Jun
24
3 months ago
Activity icon

Replied to LARAVEL With MOODLE

Looking for the same. Guess this is an insane project.

May
26
4 months ago
Activity icon

Replied to Vue Js Multiselect How To Pass Selected Values To The RegisterController?

For those who have objects with multiple attributes, this may help: https://stackoverflow.com/a/62031878/2311074

May
23
4 months ago
Activity icon

Replied to How To Setup MySQL Connection On Ubuntu (so I Can Use Docker)?

@mkshingrakhiya Okay that would be what I have to put in my .env file, right? But how can I connect to MySql that booted from docker? Either by terminal, or through PhpMyAdmin

Activity icon

Replied to How To Setup MySQL Connection On Ubuntu (so I Can Use Docker)?

@bugsysha I would like to connect to the MySQL app that I have just booted with docker. So that I can create databases etc. Either by terminal, or through PhpMyAdmin

May
21
4 months ago
Activity icon

Started a new Conversation How To Setup MySQL Connection On Ubuntu (so I Can Use Docker)?

I want to use DOCKER for my local development.

I found this guest-spotlight video which seems to be exactly for this usecase: https://laracasts.com/series/guest-spotlight/episodes/2

However, at min 04:00 he is using a commercial software called TablePlus to create a new MYSQL Connection. I have "mysql" installed, but I don't know how to setup a connection with docker.

Until now, I used Laravel Homestead and PHPMyAdmin to manage my tables.

Does anyone know how to setup a MySql Connection in Ubuntu without using TablePlus?

May
19
5 months ago
Activity icon

Commented on The Gilded Rose Kata

Hey Jeffrey, very cool - thank you! In the docs of the kata its described to not change the properties of the item class:

However, do not alter the Item class or Items property as those belong to the goblin in the corner who will insta-rage and one-shot you as he doesn't believe in shared code ownership

Here is my attempt doing it the other way around. I just added custom filters in the tick method: https://github.com/iwasherefirst2/gilded-rose-kata

May
17
5 months ago
Activity icon

Commented on Programming Katas Explained

Amazing :D

Activity icon

Commented on Liskov Substitution

I was just about to post the same :)

May
14
5 months ago
Activity icon

Commented on Object-Oriented Forms: Part 1

Just for everyone trying to do this with VUE2. The part where Jeffrey uses @keydown to delete an entry with delete this.errors[field] will not update the dom in Vue2. Instead one has to use Vue.delete(this.erros,field). See https://vuejs.org/2016/02/06/common-gotchas/

Apr
21
5 months ago
Activity icon

Commented on Server-Fetched Partials

The problem with partials and tests is that they are not encoded (they have no meta info like a html document: ). So if you try something like assertSee the random generated Username may be something like Curstis D'Amore. Thus, I think if testing for particials is awkward anyway, one may just enjoy the benefits of vue