Elenktik

Elenktik

Member Since 3 Years Ago

Experience Points
23,170
Total
Experience

1,830 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
189
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
23,170 XP
Nov
24
4 days ago
Activity icon

Started a new Conversation How To Disable QueryString/RequestPayload For API Auth?

Hi I am looking for a solution for LAravel 5.6

When using $this->middleware('auth:auth') the user token can be passed as query string, request payload or bearer token: https://laravel.com/docs/5.8/api-authentication#passing-tokens-in-requests

As far as I understood, the command $this->middleware('auth:api') is using the middleware Illuminate\Auth\Middleware\Authenticate and api specifies which guard should be used, and details of this guard are descried in config/auth.php. However, I don't see the code section that handles the query string, request payload or bearer token. Any chance I can find that code section and replace it somehow by registering a custom middleware?

Nov
22
6 days ago
Activity icon

Replied to How To Update Props From Parent?

@piljac1 I just realized that your suggested workflow does actually solve my issue!

I now have an outer inline-template component where I can pass the initial value and then I can share the value to my subcomponents:

<my-main-component-for-blade :initrows="{{$data}}" inline-template>
    <nie-table v-model =" contentrows"  ></nie-table>
</my-main-compnent-for-blade>
export default {
  props: {
    initrows: '',
  },
  data() {
    return {
      contentrows: '',
    };
  },
  created(){
    this.contentrows = this.initrows;
  }
}
Nov
20
1 week ago
Activity icon

Commented on A User May Respond To Threads

I acutally cloned the Laravel application from GIT which is running on Laravel 5.4 where withoutExceptionHandling is not a known function. I also get even from the original repo, that AuthenticationException was not thrown..? Also if I dump the respond, I can see that it was.

      $this->expectException(AuthenticationException::class);
      //  $this->withoutExceptionHandling();

        $response = $this->post('/threads/1/replies', []);
Nov
15
1 week ago
Activity icon

Replied to HasManyThrough Problems With SoftDeletes

Okay figureded it out, looks something like this:

   return $query->whereNotExists(function ($subquery) use ($user_id) {
            $subquery->select(\DB::raw(1))
                ->from('business_agreement_types')
                ->join('business_agreements as middleman', 'middleman.type_id', '=', 'business_agreement_types.id')
                ->join('business_agreement_users', 'business_agreement_users.business_agreement_id', '=', 'middleman.id')
                ->where('business_agreement_users.user_id', '=', $user_id)
                ->whereColumn('business_agreement_types.id', '=', 'business_agreements.type_id')       
        });

Activity icon

Replied to HasManyThrough Problems With SoftDeletes

@inanielhoussain did you do it using query builder? If so, could you share it? Stephens solutin withTrashedParents() only works from Laravel 7 upwards.

Nov
14
2 weeks ago
Activity icon

Replied to Do You Mock Service Classes In Feature Tests?

@bugsysha does it mean you never do database interactions in your service classes? Or do you simply not test any service class methods that involve database interactions with unit tests?

Activity icon

Started a new Conversation Do You Mock Service Classes In Feature Tests?

I have a service class called updater which I have fully covered with unit tests.

Now inside my controller, I have the following method:

public function __construct(Updater $updater)
{
    $this->updater         = $updater;
}

 public function updateCountry(BusinessAgreement $businessAgreement, Request $request): void
 {
        $this->updater->setBusinessAgreement($businessAgreement)
                              ->updateCountries($request->countries);
 }

I wonder now, if I should basically replicate my unit tests around the post call and check if entries have been correctly updated in the database, or if I should mock the updater service and just check if setBusinessAgreement and updateCountries has been called.

I feel like mocking the updater class is bad, because when I for example change the method updateCountries to updateRelevantCountries the feature test would still work, although this method does not exists.

However, I also feel that no mocking would be bade either, because then my unit and feature test are redundant, except for the fact that in the feature test I make the calls indirectly through a HTTP request.

Nov
07
3 weeks ago
Activity icon

Started a new Conversation Is There A Channel For Video Ideas?

Is there a channel for video suggestions? I think something like this would be cool. I imagine that users of the community could suggests special topics that they would like to see covered by Jeffrey and his team and people could vote if they are interested or not. At first I thought this is alreay given by the Requests channel, but when looking at it, its seems this is just used for ordinary questions?

Nov
01
3 weeks ago
Activity icon

Started a new Conversation Learn Vue 2: Step By Step

love the series and it was mind blowing to see it.

I worked through the entire 7 hour course and after completing it I have the following feedback:

  1. Some videos are simply outdated and won't work anymore. For example https://laracasts.com/series/learn-vue-2-step-by-step/episodes/30 or even the brilliant object form tutorial in https://laracasts.com/series/learn-vue-2-step-by-step/episodes/19 fails because @keydown is not working. There have also been improvements added on the github repo to allow also array and file uploads for example: https://github.com/laracasts/Vue-Forms/pull/27/files I think a remake of only those couple of videos which are broken or where there has beena big enhancment would be great.

  2. From Episode 35 on many videos started to show us how to make some changes, without the possibility for us to play around with it, because it was part of the Laracast codebase. For a 20 min video, I found it very tiring to watch because I cannot actively participate or experiment. I think it would be better to stick to simple examples that we can either create from scratch while watching or that are provided in a git repo.

  3. I found it very difficult to follow #46 https://laracasts.com/series/learn-vue-2-step-by-step/episodes/46 because it in addition to the problems mentioned at 2. it is refactoring an algolia search - which I never heard of before. Also I would have loved to learn what that is, so a lesson starting from scratch to setup an algolia search would have been fantastic I think.

  4. A general thing - when I watch the videos I make notes for each video. Once the videos are marked as done, the number is gone. Would be cool if one can still see the number when they are checked.

Oct
29
4 weeks ago
Activity icon

Commented on Workshop - Contact Support Modal

Thats also something that I would likt to know

Oct
26
1 month ago
Activity icon

Replied to How To Update Props From Parent?

Same with your mixin. It is supposed to be used to avoid code duplication, but if you need it only once, it's overkill and not necessary (might not be the case for you. because you might have use for it in multiple components, but if you don't, it is not necessary).

Yes I do reuse it in my components. I am using the form object introduced here: https://laracasts.com/series/learn-vue-2-step-by-step/episodes/19

and I found myself that my components need redundant properties, because name and v-model were always the same, like here:

<nie-input name="gender" v-model="form.gender"></nie-input>

Thus I decided that name and property of the form object will always be the same, so I only have to pass the name:

<nie-input name="gender"></nie-input>

and the coupling to form.gender happens in the component. So in short, the mixin is actually used in all my form components.

Activity icon

Replied to How To Update Props From Parent?

Yes you need to create a Vue instance somewhere, else well... Vue will simply not work lol. But what I mean is that you also bound a method on your root Vue instance that might not have uses for all of your components. You're probably working on a form that will happen on a single page (or a few), so I would move that logic one level down in a component.

Okay that makes perfect sense will do that - it will be much cleaner and I dont need to create differen *.js on my pages (except if I need to register extra components).

However, this will not change anything on my parent-child communication right? I still need either to add a second watcher prop or using v-model together with an ajax call to update the value from parent to child.

Activity icon

Replied to How To Update Props From Parent?

I think your workflow is flawed (half of your logic is root based and half is component based)

Do you mean with root-based that I create a Vue instance in my users.js? I thought that is how it works otherwise how else would the vue-components be rendered? Is this not the same as Jeffrey teaches at https://laracasts.com/series/learn-vue-2-step-by-step?

Thank you for the idea with the watcher, nice hack. About Vuex, I first need to complete my Vue courses before I move on to something advanced :)

Activity icon

Replied to How To Update Props From Parent?

@piljac1 So I guess, I could use v-model to sync parent and child component and then load the data using an ajax request?

Activity icon

Replied to How To Update Props From Parent?

@gitwithravish the problem is not passing the data from blade to a component, that works easily with <nie-table :contentrows =" {{ $data }}" ref="usersTable"></nie-table>. The problem is - how can I update the data of the component from the parent.

Activity icon

Replied to How To Update Props From Parent?

@piljac1 yes, $data is passed from the controller to the blade. My blade looks like this:

@extends('layouts.fullwidth.master-buefy') 

@push('scripts_after_vue') 
<script type="text/javascript" src="/js/trainings/users.js" defer></script>
@endpush 

@section('content') 
...
	   <b-field class="column is-full">
                  <nie-table :contentrows="{{ $data }}"  ref="usersTable"></nie-table>
                </b-field>

This is my users.js:

import Vue from 'vue'
import Buefy from 'buefy'
import Table from './../components/basics/Table.vue';
import {
  Form
} from './../form/form';

Vue.use(Buefy);

Vue.component('nie-table', Table);

Vue.mixin({
  data: function() {
    return {
      form: new Form({
        gender: '',
        vorname: '',
        name: '',
      })
    };
  }
});

const app = new Vue({
  el: '#main-content',
  methods: {
    onSubmit: function(e) {
      this.form.submit('POST', e.target.action)
        .then(data => {
               // HERE IS WHERE I WANT TO UPDATE COMPONENT DATA OF <nie-table
        })
    },
  }
});
Activity icon

Started a new Conversation How To Update Props From Parent?

I currently pass a value as a property to my child component in my blade:

<nie-table :contentrows =" {{ $data }}"  ref="usersTable"></nie-table>

Now on the parent I have a form to add more rows. When a user submits the form, an request is made with axiom. On success, I would like to tell my component nie-table to add another value to the array $data.

How can I do this?

Oct
25
1 month ago
Activity icon

Replied to Do You Have An Individual Js Foreach Blade File?

Okay, so thats what I already do, right? :D

Activity icon

Commented on Vue Subclassing

Haha good question!

Activity icon

Replied to Do You Have An Individual Js Foreach Blade File?

This is how it looks in mix:

 mix.js('resources/assets/js/training.js', 'public/js')
  .js('resources/assets/js/trainings/list.js', 'public/js')
  .js('resources/assets/js/admin/edit-seals.js', 'public/js/admin')
  .sass('resources/assets/css/app.scss', 'public/css/')

And this is for example list-js:


/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

import Vue from 'vue'
import Buefy from 'buefy'

import DragNDrop from './../components/form/UploadDragnDrop.vue';
import CustomInput from './../components/form/Input.vue';
import HiddenInput from './../components/form/InputHidden.vue';
import CustomInputSelection from './../components/form/InputSelection.vue';
import CustomInputDate from './../components/form/InputDate.vue';
import CustomInputNumber from './../components/form/InputNumber.vue';
import Trombowyg from './../components/form/Trombowyg.vue';
import Field from './../components/form/Field.vue';
import CoverImage from './../components/trainings/CoverImage.vue';
import Toggle from './../components/form/Toggle.vue';

var VueScrollTo = require('vue-scrollto');

import { Form } from './../form/form';

Vue.use(Buefy);

Vue.use(VueScrollTo);

Vue.component('nie-upload', DragNDrop);
Vue.component('trombo-wyg', Trombowyg);
Vue.component('nie-input', CustomInput);
Vue.component('nie-inputselect', CustomInputSelection);
Vue.component('nie-inputdate', CustomInputDate);
Vue.component('nie-field', Field);
Vue.component('nie-inputhidden', HiddenInput);
Vue.component('nie-coverimage', CoverImage);
Vue.component('nie-toggle', Toggle);
Vue.component('nie-inputnumber', CustomInputNumber);
var dataForm = { form:  new Form({
      numbers: [],
  })
}

Vue.mixin({
  data: function() {
    return dataForm;
  }
})


const app = new Vue({
    el: '#main-content',
    methods: {
      onSubmit: function(e) {

        this.form.submit('POST',e.target.action)
          .then(data => {

            if(typeof data === 'object' && data !== null){
              var type = 'is-warning';

              if(data.status){
                type = 'is-success';
              }

              this.$buefy.toast.open({
                  message: data.msg,
                  type: type,
                  position: 'is-bottom-right',
                  duration: 5000,
              });
              return;
            }
              location.reload();
              return false;
          })
          .catch(errors =>{
            console.log(errors);
            VueScrollTo.scrollTo('#errorbox', 200, {offset: -100});
          });
      },
      updateRangeSlider: function(selection){
        var range = selection.split('-');
        console.log(range.length );
        if(range.length != 2){
          return;
        }

        this.von = parseInt(range[0],10);
        this.bis = parseInt(range[1],10);

        var length = this.bis - this.von;

        this.showList = (this.von < this.bis);

        if(length > 15){
          length = Math.round(length/10);

          this.ticks = Array(10).fill().map((_, idx) => this.von + length * idx)
        }
        else{
            this.ticks = this.range(this.von, this.bis);
        }

        this.form.numbers= [this.von, this.bis];
      },
      range: function (start, end) {
        return Array(end - start + 1).fill().map((_, idx) => start + idx)
     }
    },
    data: {
      von: 0,
      bis: 1,
      showList: false,
      ticks: [0,1]
    }
});

And here would be training.js


/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

import Vue from 'vue'
import Buefy from 'buefy'

import DragNDrop from './components/form/UploadDragnDrop.vue';
import CustomInput from './components/form/Input.vue';
import HiddenInput from './components/form/InputHidden.vue';
import CustomInputSelection from './components/form/InputSelection.vue';
import CustomInputDate from './components/form/InputDate.vue';
import Trombowyg from './components/form/Trombowyg.vue';
import Field from './components/form/Field.vue';
import CoverImage from './components/trainings/CoverImage.vue';
import Toggle from './components/form/Toggle.vue';

var VueScrollTo = require('vue-scrollto');

import { Form } from './form/form';

Vue.use(Buefy);

Vue.use(VueScrollTo);

Vue.component('nie-upload', DragNDrop);
Vue.component('trombo-wyg', Trombowyg);
Vue.component('nie-input', CustomInput);
Vue.component('nie-inputselect', CustomInputSelection);
Vue.component('nie-inputdate', CustomInputDate);
Vue.component('nie-field', Field);
Vue.component('nie-inputhidden', HiddenInput);
Vue.component('nie-coverimage', CoverImage);
Vue.component('nie-toggle', Toggle);

var dataForm = { form:  new Form({
  title: '',
  cover: null,
  addressid: '',
  dates: null,
  mode: '',
  focus: '',
  website: '',
  price: '',
  video_url: '',
  description: '',
  remote: false,
  trainer: [],
  images: [],
  _method: '',

}) }

Vue.mixin({
  data: function() {
    return dataForm;
  }
})


const app = new Vue({
    el: '#main-content',
    data:{
      coverImage: '/storage/pages/landscape.jpg',
    },
    methods: {
      onSubmit: function(e) {
        this.form.submit('POST',e.target.action)
          .then(data => {
            window.location.replace(data)
          } )
          .catch(errors =>  VueScrollTo.scrollTo('#errorbox', 200, {offset: -100}));
      },
      updateCover: function() {
        var reader = new FileReader();

        reader.onload = (e) => {
          // Note: arrow function used here, so that "this.imageData" refers to the imageData of Vue component
          // Read image as base64 and set to imageData
          this.coverImage = e.target.result;
        }

        reader.readAsDataURL(this.form.cover);
      }
    }
});

And so on..

Activity icon

Started a new Conversation Do You Have An Individual Js Foreach Blade File?

I have completed the Learn Vue 2: Step by Step guide to 80%.

I now ended up with one *.vue file per blade file which i use as inline-template. For each, there are different components to register. So basically, I have my own *.js file for each *.vue that represents a blade where I register the individual components, and each of those has a extra line inside my webpack.mix.js

This causes my webpack.mix.js file to grow quite a bit. Is there a better way?

Activity icon

Started a new Conversation When To Use Window?

In https://laracasts.com/series/learn-vue-2-step-by-step/episodes/13 Jeffrey binds Event object to the global window. So at the top of the document he has

window.Event = new class {}

Later he access it inside Vue like this:

new Vue({

created(){
   Event.fire('example');
}

});
  1. Why does he bind it to window? It would be global anyway?

  2. Why does he not need to access the class in Vue instance as ? window.Event ?

  3. Why not use Vue mixin https://vuejs.org/v2/guide/mixins.html ?

Oct
20
1 month 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 month 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
1 month 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
1 month 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
1 month 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 month ago
Oct
12
1 month 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
1 month 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
2 months 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
2 months 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
3 months 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
3 months 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
3 months 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
4 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
4 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
4 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/