burlresearch

burlresearch

Consultant at https://burlresearch.com

Ottawa

Hire Me

Member Since 4 Years Ago

Experience Points 110,700
Experience
Level
Lessons Completed 700
Lessons
Completed
Best Reply Awards 95
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

12 Dec
1 day ago

burlresearch left a reply on How To Open List Where Parent_id 1

Just as I wrote in the explanation. Before you click, this.adverts = [] so the 2nd list will contain no items. When you @click="sendAdvert(category.id)" you will call your HTTP endpoint that will populate the list of child-objects, into your this.adverts.

Then Vue will pickup the change and render the list items, in:

Child Listing (after your Categories)

<ul class="list-group">
    <li v-for="advert in adverts" :id="'advert-'+advert.id" class="list-group-item">{{ advert.name }}</li>
</ul>
10 Dec
3 days ago

burlresearch left a reply on How To Open List Where Parent_id 1

I think the first thing is to realize that your Category is related to itself, and that you can represent this relation just like any other Eloquent relation.

class Category extends Model {
  public function parent() {
    return $this->belongsTo(Category::class, 'parent_id');
  }

  public function children() {
    return $this->hasMany(Category::class, 'parent_id');
  }
}

This way, you can get all the children of an object like this:

>>> Category::find(1)->children
=> Illuminate\Database\Eloquent\Collection {
     all: [
       App\Category {
         id: 2,
         parent_id: 1,
         name: "Devil",
         created_at: "2016-08-17 09:58:54",
         updated_at: "2018-04-18 10:34:52",
       },
       App\Category {
         id: 3,
         parent_id: 1,
         name: "Taz",
         created_at: "2017-05-08 00:24:19",
         updated_at: "2018-02-26 20:32:14",
       },
     ],
   }

Then your store() method is simply returning the children:

public function store(Request $request)
{
    $id = $request->id;
    $category = Category::find($id);

    return $category->children;
}

(Although I don't think this is well-named, this method should really be called children(); and better accessible as a GET request, but you can refactor later.)

Now, when you call: axios.post('adverts/store', { id: id })

Your response data will be adverts as you have it, an array of child objects. I suppose you could add a second list, for the children, in a second list (however you want to handle it):

<ul class="list-group">
    <li v-for="advert in adverts" :id="'advert-'+advert.id" class="list-group-item">{{ advert.name }}</li>
</ul>
06 Dec
1 week ago

burlresearch left a reply on Static Methods And Method Chaining

In order to chain methods, the trick is to, at the end of each function, return a reference to object that was just called. The object then has a function defined on it for the next thing in the chain.

Your MyStaticMethod is static - so you're probably not returning a reference to the object when returning self. You could try returning new self, but you'll have to test:

    public static function MyStaticMethod($param) {
        // do __METHOD__
        return new self;
    }

this will call the constructor on the current class, and return an object that you can chain.

For the non-static method, if it's just modifying the current object, you can probably just: return $this;

02 Dec
1 week ago

burlresearch left a reply on Mail Not Sending Cc

sounds like an issue more with your mailer, than with how you're sending...

01 Dec
1 week ago

burlresearch left a reply on Jobs Applications Board

You'll want to name your pivot table according the Laravel table naming convention. Of course, you don't have to, but it will make things work a little smoother if you use the name: job_user table.

To define this relationship, three database tables are needed: users, roles, and role_user. The role_user table is derived from the alphabetical order of the related model names, and contains the user_id and role_id columns.

https://laravel.com/docs/master/eloquent-relationships#many-to-many

Once that is setup, you'll be able to see if a User has a related Job record with a query, maybe like:

$jobid = 123;
$user = App\User::find(1);
$already_applied = $user->jobs()->where('id', $jobid)->count() > 0;

burlresearch left a reply on Mail Not Sending Cc

https://laravel.com/docs/master/mail#sending-mail

The cc method accepts an email address, a user instance, or a collection of users. If you pass an object or collection of objects, the mailer will automatically use their email and name properties when setting the email recipients, so make sure these attributes are available on your objects.

So you should be able to simple pass the user for your to target, and according to docs, a simple email address int he cc field should do the trick.

Mail::to($event->user)  // User object, with `email` field
  ->cc('test[email protected]')  // email address should work
  ->send(new AccountRenewalEmail($event->user, $mailcentre, $payment));
29 Nov
2 weeks ago

burlresearch left a reply on Laravel Horizon Handle Long Running Jobs

Instead of running 1 Job that does 200,000 things - it might be better conceived to run 200,000 Jobs that do 1 thing each.

Think about how to process each specific job chain, and think about error recovery. It's much easier to handle 1 single error than it is to handle an error in the middle of 200,000 things. What do you do for the rest?

I'd say turn your thinking inside-out.

28 Nov
2 weeks ago

burlresearch left a reply on Get Record Of The Item Before Specific Date

sorry dude, now I'm even more confused.

Do you want the last 5 entries before the current, empty, one? Or just the last non-null one? This doesn't seem to be as hard as you're making it?

burlresearch left a reply on Get Record Of The Item Before Specific Date

What I posted is just 2 snippets to help with the code you posted here. The question on SO seems rather different. After reading it, I suspect there is more going with what you want. I'd like to help, but you'll need to clarify.

Does the current day-of-week matter?

IE if today is Tue, but has no data, do you want the data from last Fri, or do you want the data from last Tue (assuming both have data)?

burlresearch left a reply on Get Record Of The Item Before Specific Date

I have these 2 lines which may help you:

>>> Carbon\Carbon::parse( 'Nov 21' )->day
=> 21
>>> collect([15, 18, 10, 20, 32])->filter(function($i) { return $i < 21; })->max()
=> 20

burlresearch left a reply on Vue: Truncate Filter With Html?

Sure thing - filters are a great way to do this, with Vue. I do this to truncate text entries when rendering table columns:

    filters: {
      trunc(str, len = 87) {
        _.trim(str);
        return _.truncate(str, {'length': len});
      },
    },

Called from the template section (with optional len argument):

              <template slot="purpose" slot-scope="data" v-if="data.item.experiment">
                <abbr :title="data.item.experiment.purpose">
                  {{ data.item.experiment.purpose | trunc }}
                </abbr>
              </template>
26 Nov
2 weeks ago

burlresearch left a reply on Supervisor Queue:work Failing

Sorry bro, just trying to help.

I can't get away from the fact that the error is PDOException [2002] Connection refused - why would the database refuse a connection during the Job, but not from a Console command?

Something is different there - and that's the issue, it seems. By the sounds of it you have supervisor and your queue:worker setup OK.

Does your queue worker call the same code path as the Console application? What does your crontab -l -u www-data look like? (It's calling your Job scheduler correctly?)

Again, my spidey-sense says it's something other than the queue worker...

burlresearch left a reply on Supervisor Queue:work Failing

This doesn't sound like an issue with supervisor as much as it sounds like an issue with your database crashing. This probably shouldn't be happening.

Even in the event of the database going down temporarily - I can see that some jobs would fail - but supervisor ought to pick up OK and keep processing any new work.

There is pretty good explanation on how to deal with failed Jobs:

https://laravel.com/docs/5.7/queues#dealing-with-failed-jobs

I'd recommend using Horizon, instead, if you want a nice way to see what's going on:

https://laravel.com/docs/5.7/horizon

21 Nov
3 weeks ago

burlresearch left a reply on Regex Is Almost Complete

Not sure what you're going for, if you need the full-name to be exactly the whole line, but with regex, as mentioned, the simplest solution always wins. What about:

/[а-яА-Я][ы-эЫ-Э]\s+[а-яА-Я]+/

burlresearch left a reply on L5.6 Broadcast And Queue Both To Use "redis"

You certainly can use redis to back any of your drivers, I often use it for all three of:

CACHE_DRIVER=redis
SESSION_DRIVER=redis
QUEUE_DRIVER=redis

in a project, simultaneously. Never had a problem. There must be something with your config.

Have you done:

composer require predis/predis

burlresearch left a reply on Supervisor Queue:work Failing

I wouldn't run the command as user=root - I'd bet that there's something weird going on with the user permissions. Try and switch root for the user that owns your application, what user is returned by:

stat -c%U /var/www/site/artisan

14 Nov
4 weeks ago

burlresearch left a reply on Compute Values And Insert Them In The View

I didn't actually run this code, so it probably will need a little tweaking to run.

You can see that when we iterate over the subproducts, we use the key there to store the sum.

So for your products.key (in your example [3, 4]) the idea would be to store the durationSum in that slot: dur[3], and dur[4], respectively. That gets accumulated when we each over the subarray:

durs[key].add(...);

13 Nov
1 month ago

burlresearch left a reply on Compute Values And Insert Them In The View

I'm not sure about how you're using your computed property, but I have an idea for the meat of the issue. You're using Vue, so if you haven't disabled them, you likely have moment.js and lodash.js still loaded - I'd take advantage of these libraries to help with the Duration calculations:

accumulate() {
    let durs = [];

    _.each(this.user[0].products, function (subproducts, key) {
        durs[key] = moment.duration();   // start at 0

        _.each(subproducts, function (i) {
            durs[key].add(moment.duration(i.time));  // accumulate sub-product durations
        });
    });

    let seconds = _.map(durs, function (i) {
        return i.asSeconds();   // https://momentjs.com/docs/#/durations/as/
    });

    // seconds <- (5) [empty, empty, empty, 11, 29]
},
09 Nov
1 month ago

burlresearch left a reply on What Is .then For?

the .then() represents the success response path of an asynchronous Promise in JavaScript.

A Promise is an object representing the eventual completion or failure of an asynchronous operation.

In your example the call to axios.get(url) returns such a Promise, and the .then() code branch is only entered later, on the successful return of that call. It may fail. Also it may take some time, yet your application continues to run, asynchronously while waiting.

It may be helpful to read some more background:

There are several good reasons for the move to use the Promise architecture in JS.

04 Nov
1 month ago

burlresearch left a reply on Relation With Pivot Table

You're right, hasManyThrough is just a shortcut for a 2 step belongsTo - so it's essentially a many-to-one.

I wonder if your Influencer-Social relation is many-many, it likely that an Influencer generally has only 1 account / platform, so maybe you could get away with 1-many here - not sure though, perhaps you have exceptions to this.

Of course, it's up to you, and your domain knowledge + requirements, but you may want to instead think of the Campaign as being polymorphic and spanning many social platforms, but rather sort of being a Tag or a label you assign the the various Influencer-Posts.

01 Nov
1 month ago

burlresearch left a reply on Find Neighbors

It would be up to you define "what is a neighbor" and to implement that yourself.

You could start by making this a function on your Model, and refactor from there if you want a Repository pattern, or whatever you like.

It's up to you do define your concept of adjacency. If by next / prev you just want to go by ID's then you could do something like:

class Profile extends Model {
    public function next() {
        return self::find($this->id + 1);
    }
    public function prev() {
        return self::find($this->id - 1);
    }
}
31 Oct
1 month ago

burlresearch left a reply on I Cant Understand Fluent Interfaces

Nah. The point of static interfaces is that there is no context, you don't need an instance to call them - they're just there ready to process something for you.

I think the point of the fluid chaining is to progress an instance through a state-machine. So having static functions here don't really make sense.

When you make your methods static public then you must abandon the $this reference in the function, it has no context.

burlresearch left a reply on Convert Multiple Array Into A String In Laravel

If you want a string, then use implode, if you need an array, then stop at pluck:

Establishments::where('status', 0)
    ->where('city', '=', $data['location'])
    ->pluck(['id'])
    ->implode(',');
// > "43,71,41,39"

Establishments::where('status', 0)
    ->where('city', '=', $data['location'])
    ->pluck(['id']);
// > [43, 71, 41, 39]
30 Oct
1 month ago

burlresearch left a reply on Improve The Search By Specific Date In Laravel

You could do this in a single call:

$from_date = Carbon::parse(request('from_date'));

Events::whereBetween('from_date', [$from_date->startOfDay(),$from_date->endOfDay()])->get();

I don't think this changes the accuracy, but it might do what you want...

burlresearch left a reply on I Cant Understand Fluent Interfaces

Given that you've watched the episode then it seems pretty clear that the create() method would simply end with: return $this;

So, you could then chain the call forward to the next method.

I suppose your real question is how to create the dynamic method setThing() which does a set action on the the Thing column. Perhaps you should refer to how Taylor does it in the Illuminate source code, for the trait ForwardsCalls:

src/Illuminate/Support/Traits/ForwardsCalls.php

https://github.com/laravel/framework/blob/5.7/src/Illuminate/Support/Traits/ForwardsCalls.php#L20-L38

    protected function forwardCallTo($object, $method, $parameters)
    {
        try {
            return $object->{$method}(...$parameters);
        } catch (Error | BadMethodCallException $e) {
            $pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~';
            if (! preg_match($pattern, $e->getMessage(), $matches)) {
                throw $e;
            }
            if ($matches['class'] != get_class($object) ||
                $matches['method'] != $method) {
                throw $e;
            }
            static::throwBadMethodCallException($method);
        }
    }
28 Oct
1 month ago

burlresearch left a reply on How To Get The Sum Of All Fares

If you have Lodash then this could be much simpler:

getFareTotal() {
  return _.sumBy(this.form.ticketInvoiceItems, 'fares');
},
20 Oct
1 month ago

burlresearch left a reply on Retrieve Only Identical Array

I can think of a couple ways to do this, off-hand:

  1. array_unique(array_merge($names, $tags))
  2. array_merge($tags, array_diff($names, $tags))

burlresearch left a reply on How To Exit Out Of Saving A Record If A Condition Is Not True

This makes no sense, whatever you are trying to do, I think you need at least 1 more variable.

This code has bigger problems than deciding how to fail.

12 Oct
2 months ago

burlresearch left a reply on Re-loading Part Of The Page When Adding New Data

If you're really gung-ho about the async refresh then you could go all client-side, but I'd probably recommend a vue component for that. This way you may still pass in the $pageList set from the controller - to a $prop in Vue, OR, you could just fetch the data on mounted() of the Vue instance.

That could look like:

mounted() {
      axios.get('/api/newpage').then(res => this.pages.push = res.data);
}
11 Oct
2 months ago

burlresearch left a reply on Re-loading Part Of The Page When Adding New Data

Vue's 2-way data binding works by rendering lists of item's. If that list of items is modified after render, then Vue will take care of it, only if the list is managed by a Vue v-for. Which is not true, in your case. You have 2 options:

  1. reload the page, outright
  2. modify the Blade foreach loop you have to be a Vue iterator

Either way, you'll have to do something in the axios.post().then() block.

For 1. it would be window.location.reload(); - that may work.

For 2. you have to convert the blade foreach to be a Vue-rendered list, and push the page name into that list, in the then() block.

It might look something like:

    axios.post('/api/newpage', {
          .then(res => {
            this.pages.push(res.data);
    })

Or something close to that.

burlresearch left a reply on Export

It may depend on your version of Laravel that you are running: php artisan -V

If it's not recent enough, then you have to add to the providers list in your:

config/app.php

    'providers' => [
    // ...
        /*
         * Package Service Providers...
         */
        Maatwebsite\Excel\ExcelServiceProvider::class,

    // ...
    ],

and if that still doesn't work, then you could try:

$ composer dump-autoload

that should do it, you should be able to verify that that make:export command is in the list:

$ php aritsan list make

This basically is the config described in the setup. Trace it, what's missing?

10 Oct
2 months ago

burlresearch left a reply on How To Pass Data Image Location Using JQuery And Show It In Modal

I'm a little confused by what I'm seeing, but I think I would:

  1. put the click on the button
  2. presume that the data-userphoto is the full url (?!)
  3. then use jQuery to replace the img.src property in the modal:
$('.showuser').click(function () {
  $('.form-group img').prop('src', $(this).data('userphoto'));
});

no?

09 Oct
2 months ago

burlresearch left a reply on Scheduler

You certainly could schedule a task to do this. But you still need to have a task to schedule.

The way I generally is to start with an Artisan command that does the thing, then it's fairly easy to:

  1. riff on
  2. test
  3. call later from your code
  4. schedule

So, I'd start by writing your command with:

php artisan make:command --command=email:template -- EmailTemplate

and get that working. Then you can schedule it any way you want, even directly as a CRON job, at 9:15 tomorrow:

15 9 10 10 * /usr/bin/php /srv/laracasts/artisan  email:template > /dev/null 2>&1

burlresearch left a reply on Array Transformation

This transformation can be achieved with simple a combine:

public function handle()
{
    $contacts = [
        'name'  => ["A", "B",],
        'phone' => ["1", "2",],
    ];

    $USE_ELOQUENT = false;

    if ($USE_ELOQUENT) {
        $coll = collect($contacts['name'])->combine(
            $contacts['phone']
        );
    } else {
        $coll = array_combine($contacts['name'], $contacts['phone']);
    }

    dump($coll);
}

Is there more to it? Did you mean to use an Eloquent approach?

burlresearch left a reply on Two Foreign Keys Referencing The Same Primary Key

I think the simplest thing here, is for you to protect yourself against trying to dereference a [potentially] null-value, something like:

@foreach($task as $taskItem)
  @if($taskItem->assignedTo)
    <p>{{ $taskItem->assignedTo->name }}</p>
  @endif
  {{-- OR, --}}
  <p>{{ optional($taskItem->assignedTo)->name }}</p>
@endforeach 
05 Oct
2 months ago

burlresearch left a reply on How To Call Laravel Route From Js Script File?

The use of named routes is pretty well defined:

https://laravel.com/docs/master/routing#named-routes

but, yes, your second definition does seem to work - but I'd stick with what the documentation says to do.

04 Oct
2 months ago

burlresearch left a reply on How To Call Laravel Route From Js Script File?

no - those 'named routes' in your routes files are for Laravel on the server-side. Javascript on the client-side does NOT have access to the mechanisms to decode these.

You're best left to use the URI field from php artisan route:listto form your href entries in JS.

$ php artisan route:list
+---------------+---------------------+------------------+----------------+--------------+
| Method        | URI                 | Name             | Action         | Middleware   |
+---------------+---------------------+------------------+----------------+--------------+
| POST          | api/markers         |                  | Closure     ...| api          |
| GET|HEAD      | api/subcat          | subcat.index     | App\Http\Con...| api          |
| POST          | api/subcat          | subcat.store     | App\Http\Con...| api          |
| GET|HEAD      | api/subcat/create   | subcat.create    | App\Http\Con...| api          |
| GET|HEAD      | api/subcat/{subcat} | subcat.show      | App\Http\Con...| api          |

01 Oct
2 months ago

burlresearch left a reply on Jquery Not Defined

Plus, check your use of asset() - not sure what your project structure looks like, but I suspect this isn't generating the correct path for you, either:

>>> asset('img/photo.jpg')
=> "http://laracasts.test/img/photo.jpg"

burlresearch left a reply on Create And Edit Data With Single Form

Are you storing/fetching an old token somehow? This really doesn't make sense, as the token should have nothing to do with the form-data being sent. Just a thought.

You may want to post some more code here for us to look at - this isn't enough to go on.

30 Sep
2 months ago

burlresearch left a reply on How To Upload Multiple Images With Dropzone

I wouldn't try to fight Dropzone. I would:

  • let it upload the files to your Laravel server as soon as they are dropped
  • verify the upload is roughly what you expect
  • store the files locally
  • return the pathname
  • store those pathnames as a hidden input in the form
  • then, when the form is completed and validated, grab those files and upload them to S3

Here is an upload() function that I have used:

public function upload(Request $request)
{
    \Log::debug(__METHOD__, $request->toArray());
    $response = ['status' => 'ack'];

    if ($request->hasFile('file') && ($request->file->isValid())) {
        $fname = sprintf("%s-%s", date('ymdhis'), $request->file->getClientOriginalName());

        $stored             = $request->file->storeAs('uploads', $fname);
        $response['stored'] = $stored;

        if ($this->checkValidUploadType($stored)) {
            ImportJob::dispatch($stored);   // artisan make:job ImportJob
        } else {
            unlink(storage_path('app/' . $stored));
            abort(406, 'Unrecognized CSV header.');
        }
    } else {
        $response['status'] = 'error: during upload';
    }

    return $response;
}
28 Sep
2 months ago

burlresearch left a reply on How To Add A Where Clause For A Resource By Default?

I thought your question was about modifying global scope

I want to modify the resource query by adding a where clause by default

If you don't want it to always apply, then consider using local scopes

burlresearch left a reply on Notification

If the people on the site are not logged in - then the Auth::user() will most certainly be null.

This is your error, by definition.

I think what you want is just simply fire a new NotifyDashboard event, should be something simple like: event(new NotifyDashboard)

Maybe check for more info:

https://laravel.com/docs/master/events

burlresearch left a reply on How To Add A Where Clause For A Resource By Default?

Sounds like you want to check out Eloquent Global Scopes for your model. If I read your question correctly, this will allow you to modify all() queries against your model, by default.

Global scopes allow you to add constraints to all queries for a given model. Writing your own global scopes can provide a convenient, easy way to make sure every query for a given model receives certain constraints.

26 Sep
2 months ago

burlresearch left a reply on Laravel API Endpoint Pattern

Honestly I wouldn't differentiate between the routes at all. I'd like the application serve up the data at the route endpoint: /jobs/{jobId}

Then, I'd treat the request to the model with the appropriate Authorization Policy to see if the user making the request should be allowed to have the information, or whether to abort(403)

burlresearch left a reply on Vue Default Selection For Select

Once I figured out vue-select, which works fine for either single or multiple select inputs, I have been using them ever since - they do simplify a lot of logic, and I hate excessive javascript:

<template>
  <form @submit.prevent="submit">
    <form-group id="company" label-for="company" label="Company">
      <v-select :options="companies" v-model="formdata.company"></v-select>
    </form-group>
  </form>
</template>

<script>
  import vSelect from 'vue-select';

  export default {
    components: {vSelect},
    data() {
      return {
        form: new Form,
        formdata: {},
        companies: [
          {'value': 1, 'label': 'Acme Inc'},
          {'value': 2, 'label': 'Beta Ltd'},
          {'value': 3, 'label': 'Chaz Co.'},
        ],
      };
    },
    methods: {
      submit() {
        this.form.save('/form-end-point', this.formdata)
          .then(() => console.log('submitted'))
          .catch(err => console.log('ERRORS', err.response));
      },
    },
  };
</script>
25 Sep
2 months ago

burlresearch left a reply on How Would I Tackle This Code (Vue) In Laravel? Parsing XML

In order to parse the XML data, you could start with SimpleXML:

http://php.net/manual/en/simplexml.examples-basic.php

Guzzle used to wrap this for you:

http://docs.guzzlephp.org/en/5.3/quickstart.html#xml-responses

But it looks like it leaves it up to you now to manage the payload yourself.

burlresearch left a reply on Sequence Code Does Not Work

the way this works, @slickness , is:

  1. when you ask a question
  2. and someone takes the time to answer it and suggests code
  3. you study the tip and make it work for you
  4. you learn something
  5. you mark their answer as best answer, not your own study notes
24 Sep
2 months ago

burlresearch left a reply on How To Access All Values From Calculated Field And Pass Them In Array?

The get() will return a standard Laravel Collection. So, as usual, to "access a column" you could pluck the values, of any of the selected elements:

$excelentes = ...->get();

$names = $excelente->pluck('name');
$cantidads = $excelente->pluck('cantidad');

But calling first() on the collection will return only the first element. So, as @dextercampos mentions - you still need to iterate through the collection, either using foreach, or one of the other Collection Iterators

burlresearch left a reply on Vue Default Selection For Select

There are nice plugins for this which provide all the functionality you'd ever want:

Both of these automate everything about selects in Vue, with a little configuration. Let us know if you're interested in going this route, or if you really want to code-your-own.

21 Sep
2 months ago

burlresearch left a reply on Radio Button Array Store

<input onclick="sendRating({{$book['id']}}, {{$rating}})" id="b-{{$book['id']}}}-r-{{$rating}}" name="book-{{$book['id']}}" value="{{$rating}}" type="radio" class="">

Then you just have to write the javascript function sendRating, or whatever you want to call it...