TonsOfLaz

TonsOfLaz

Member Since 4 Years Ago

Experience Points 5,830
Experience Level 2

4,170 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 56
Lessons
Completed
Best Reply Awards 0
Best Reply
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.

09 Mar
2 months ago

TonsOfLaz left a reply on Any Resources For How I Can Decouple Laravel Spark From My App?

@gcwilliams Thanks very much for this, I may go that route if I keep Spark in some fashion. It is extremely useful to know you have done it before, and thank you for sharing!

08 Mar
2 months ago

TonsOfLaz left a reply on Any Resources For How I Can Decouple Laravel Spark From My App?

@d9705996 thanks for the thoughts on it, and the links.

Yeah, I expect it to be real messy, given its keeping user data on the subscription on the front end and the back end, so middleware and Vue objects. Not looking forward to this at all!

TonsOfLaz started a new conversation Any Resources For How I Can Decouple Laravel Spark From My App?

Hi,

I built an app a year or so using Laravel Spark, but that decision is catching up with me, specifically around billing and active accounts. Basically, I never should have used Spark, as I need flexible billing options (i.e. they mail me a check), and subscriptions that cover flexible dates (i.e. people pay annual subscriptions for one calendar year like 2019, not Jun-Jun).

Long story short, having laravel Spark handle subscriptions is causing all kinds of problems for me, and I am wondering if anybody has had any experience or has found any resources on decoupling Spark for payments and billing.

I just want to be able to set my own flag for if someone is subscribed, rather than checking some Stripe or credit card thing.

I appreciate any ideas or shared experience! Thanks in advance

04 Apr
1 year ago

TonsOfLaz left a reply on Valet Start / Install Causes Mac To Restart

I am getting the same issue, but on Yosemite. Really hoping I don't need to upgrade my OS to keep using Valet!

18 Mar
1 year ago

TonsOfLaz left a reply on How To Build A Basic Alexa Interaction Using Laravel

thanks @memdev , I haven't had a chance to go through the screencast yet, but it looks promising!

08 Jan
1 year ago

TonsOfLaz left a reply on How To Build A Basic Alexa Interaction Using Laravel

Hi @hardik thanks for the link. I did see that, I have just been hoping I can find a good screencast! The developer there mentions that he will make some at some point, but there aren't any yet.

TonsOfLaz left a reply on How To Build A Basic Alexa Interaction Using Laravel

Hi @Cronix , here is the interaction I am thinking, specifically:

User: "Alexa, APPNAME Update" Alexa: "Today there have been 5 new MODELNAMES and 3 new scheduled meetings"

This information I have in mind is generic to all users of the app, and just gives them some background on the shared info. They can then log in as normal through a browser if they want to see details.

It just needs to hit a route in my app, run some small query, and return a string of what to say. No specific input (yet) or back and forth, or Auth requirements, just a quick way for someone to get a generic update of what has happened today with the app.

TonsOfLaz started a new conversation How To Build A Basic Alexa Interaction Using Laravel

Hi, I am not sure if this is the right place, but I have been looking for solid info on how to conect a Laravel app with Alexa, and I haven't found anything as good as a Jeffrey Way tutorial would be.

I would love to see something on here, thank you for your time!

31 Oct
1 year ago

TonsOfLaz left a reply on The Spark White Screen Of Death

I am a bit confused that nobody else is getting this. I am having a really hard time adding any sort of other Vue functionality to my Spark project. I keep getting a blank white screen and no indication about where/why/how/what might be happening.

Have other people been able to easily add Vue into their Spark projects? I haven't found any resources on here to help with it yet, but it seems like I am either missing something obvious or people aren't using their own vue with their Spark projects.

24 Oct
1 year ago

TonsOfLaz left a reply on The Spark White Screen Of Death

For future reference, I get this screen when there is any error or problem rendering the blade view. So for instance, i did a {{ dd($var) }} in the blade view, and that gives the White Screen of Death (WSoD).

I also had an invalid foreach, i.e. @foreach ($invalid->object->list as $item)

and instead of any normal error message from blade, I get the WSoD.

It must have to do with the Vue display of the Spark app. If something breaks the normal view, it still tries to render it through vue and we get the blank screen and no clues, unfortunately.

TonsOfLaz started a new conversation The Spark White Screen Of Death

Does anyone know how to get around the Spark blank screen? Basically, some condition (maybe a javascript error, maybe a vue error, but it doesn't show in the Console so I am not sure of the general rule yet), the page loads but is entirely hidden. I get just a blank white page with no indication of what went wrong, but I can see it all in the page source.

First off: are other people getting this? Have you seen a way around this? What's going on?

Thanks for any thoughts, anything is appreciated!

02 Oct
1 year ago

TonsOfLaz left a reply on Is It Possible To Use Laravel Dusk Browser Outside Of Testing?

Just as a followup for anyone else using this package: It doesn't mention in the docs, but every instance of a Laravel\Dusk\ class should be replaced with an equivalent instance of the new class, i.e.

File: tests/DuskTestCase.php

use Laravel\Dusk\TestCase as BaseTestCase; should now be: use Travoltron\DuskSecure\TestCase as BaseTestCase;

etc.

01 Oct
1 year ago
27 Sep
1 year ago

TonsOfLaz left a reply on Is It Possible To Use Laravel Dusk Browser Outside Of Testing?

update: Hi @travoltron I installed your package (https://packagist.org/packages/travoltron/dusk-secure , as you list above), and it worked great! I was able to install it on a production server and use it to scrape websites from my production app.

I had been doing it anyway (security be damned), so this is much much better long term.

I tagged your answer as the Best answer. I really think people will go nuts for using Dusk to scrape instead of just test their own apps. The potential uses are incredible.

Thank you so much!

25 Sep
1 year ago

TonsOfLaz left a reply on Is It Possible To Use Laravel Dusk Browser Outside Of Testing?

hey @travoltron , whoa, nice! I missed this when posted, I will check it out.

23 Sep
1 year ago

TonsOfLaz left a reply on Spark And Team Billing Vs Account Billing

I have similar questions about Spark. I am trying to use it right now for almost the exact purpose you describe -- and so far I think it will work, with per-user billing being the biggest question.

As to team billing: My understanding is that you can have someone gain access by paying for team, but you can also create new teams that are unpaid. The key point is how each user gains access. If they are part of the paid team, then they have access. If they are invited to the unpaid team, they would need to create their own payment plan to gain access to the system. So every user has to either be part of a paid team or have a single user account. Both options (team billing and user billing) are possible at once.

What I have not figured out how to do yet is charge per user on the team. There is one resource here, but it seems very minimal and incomplete (or at least, there is not enough description on it for me to tell how the details would work):

https://gist.github.com/dillinghamio/7f3b776e0ff1007cc877d63d6aaee10d

Curious to hear if you got farther in this. I am hoping to experiment in the next few months.

13 Jun
1 year ago

TonsOfLaz left a reply on Is It Possible To Use Laravel Dusk Browser Outside Of Testing?

thanks @MikeHopley for the thoughts. I have found another way as well, but I think running the artisan command is likely a cleaner approach. For what it's worth, the following that I have implemented also seems to work:

In my Command class:

public function handle()
    {
        $testcase = new DuskShell;
        $testcase->prepare();
        $testcase->testBasicExample();
    }
}

class DuskShell extends DuskTestCase {
    
    public function testBasicExample()
    {
        Browser::$baseUrl = 'http://etcetcetc';
    ...
    }
}

Using this I can use the Browser object to navigate websites as someone with a browser would.

And thanks for the thoughts on the security risks, I will keep it in mind. It would be nice if every page with legally-usable data behind POST calls and ajax loading had an API too, but unfortunately not yet...

12 Jun
1 year ago

TonsOfLaz started a new conversation The Mix Manifest Does Not Exist.

I have been trying to get a Spark install to work, just at the most basic level. Is there a reliable set of steps anyone knows about? I just get the same error every time I click Login or Register, and I don't know where the breakdown is. I don't see any hints in the install guide about the "Mix Manifest"

ErrorException in helpers.php line 582: The Mix manifest does not exist. (View: /Users/myuser/Developer/myapp/resources/views/vendor/spark/layouts/app.blade.php) (View: /Users/myuser/Developer/myapp/resources/views/vendor/spark/layouts/app.blade.php)

I am using Laravel Valet, so maybe that's the problem?

I have had good luck with most Laravel installs and Quick Start guides, but I can't find a solution to this that has worked yet. I have the following front end stuff.

npm -v
5.0.0

yarn install v0.24.6

Has anyone been stuck here, at the beginning? Thanks in advance for any tips!

TonsOfLaz left a reply on Is It Possible To Use Laravel Dusk Browser Outside Of Testing?

Hi @Indemnity83 , the more complicated reason is that the site I will be scraping has several places where it is much easier to click as a user than to scrape using a tool like guzzle. They use javascript, ajax, and the require some pages to be accessed through POST calls.

So my example is really just to get started using the Browser as a method to do scraping, outside of testing. I didn't want the more complicated use cases I hope to tackle to distract from the primary goal of using this new way of pulling up page data.

I really think Dusk could be a powerful scraper if I can figure out how to use it from a console command!

08 Jun
1 year ago

TonsOfLaz started a new conversation Is It Possible To Use Laravel Dusk Browser Outside Of Testing?

Hi,

I have been using Laravel Dusk for basic testing, and it has been great. I now have a case where it would be helpful to be able to use the Dusk browser in my main application code. Basically I want to be able to hit a route, check a value, etc using the nice Dusk syntax.

Right now it seems very coupled with testing. Has anyone been able to, or think they know a way to use the browser as a normal part of the application? (i.e. within a console command?)

Thanks in advance!

05 Jun
1 year ago

TonsOfLaz left a reply on Testing A New Package: "Class Not Found" Error

The key here seemed to be to add the Laravel environment into the testing folder. From there, you can 'register' your package provider, and use it in the way you would the rest of your Laravel application.

The only way I was able to resolve this issue was by adding the laravel helper package orchestra/testbench, using this command at my package root:

composer require --dev "orchestra/testbench=~3.0"

From there I followed the directions on this page: https://github.com/orchestral/testbench

Here is my new BasicTest.php

<?php
namespace MyName\MyPackage\Test;

use MyName\MyPackage\MyPackage;

class BasicTest extends \Orchestra\Testbench\TestCase
{

    protected function getPackageProviders($app)
    {
        return ['MyName\MyPackage\MyPackageServiceProvider'];
    }

    public function testSomethingIsTrue()
    {
        $obj = new MyPackage;
    }
}

And here is the MyPackageServiceProvider, which is in the same folder as the main MyPackage class:

<?php

namespace MyName\MyPackage;

use Illuminate\Support\ServiceProvider;

classMyPackageServiceProvider extends ServiceProvider
{
    public function boot()
    {
        //
    }
    public function register()
    {
        $this->registerMyPackage();
    }
    private function registerMyPackage()
    {
        $this->app->bind('MyPackage',function($app){
            return new MyPackage($app);
        });
    }
}

So ultimately, this had something to do with registering packages, but I am not sure why the other setup did not work and it could not find the class. I hope this helps someone else, I would love to know more if anyone has found a resource on this stuff.

TonsOfLaz left a reply on Testing A New Package: "Class Not Found" Error

hi @Cronix , thanks for the reply. Yes, I have tried composer dump-autoload, unfortunately it did not make any difference.

I have also not been able to find any resources or examples of testing a package in Laravel 5, beyond one page that doesn't show the namespacing code at all: https://websanova.com/blog/laravel/creating-a-new-package-in-laravel-5-part-5-unit-testing

If anyone has seen a package that uses phpunit tests in it, please let me know, I may be able to look through their setup for the answer. Thanks

TonsOfLaz left a reply on Testing A New Package: "Class Not Found" Error

Hi @jbloomstrom , thanks for the reply, but unfortunately, I get the exact same error with and without the absolute path () added at the front.

TonsOfLaz started a new conversation Testing A New Package: "Class Not Found" Error

Hi, I am working on creating my first package. I have put the code in the expected places, following a tutorial on it, and I can use the package from within my code fine. The problem I am having is that I would like to add phpunit tests to the package.

For some reason that is really confusing me, I just cannot get the test to even find the primary class of the package. It is making no sense to me right now, so I am wondering if anyone else may be able to see an immediate problem.

Here is my folder structure:

packages
--| MyName
----| MyPackage
------| src
--------| MyPrimaryClass.php
--------| MySecondaryClass.php
------| testing 
--------| BasicTest.php
------| composer.json
------| phpunit.xml

Here is my BasicTest file:

<?php
namespace MyName\MyPackage\Test;

use MyName\MyPackage;

class BasicTest extends \PHPUnit\Framework\TestCase
{

    public function testSomethingIsTrue()
    {
        $obj = new MyPackage;
    }
}

Here are the relevant parts of the composer.json:

"autoload": {
        "psr-4": {
            "MyName\\MyPackage\\": "src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "MyName\\MyPackage\\Test\\": "tests"
        }
    },

And here is the error I am getting every time I try to run the test, on the line where the MyPackage object is created:

There was 1 error:

1) MyName\MyPackage\Test\BasicTest::testSomethingIsTrue
Error: Class 'MyName\MyPackage' not found

So this is a really straight forward attempt to just run a test on a package. Does anyone see a problem with this, or is there an example someone might have with a basic testing setup on a package?

Thanks very much in advance!

26 Mar
2 years ago

TonsOfLaz started a new conversation Clicking Multiple Links On The Same Page With Dusk

First off, Dusk is incredible. But I have the need to cycle through a series of links on my page, regardless of what the link text or url is. I want to click each and verify they go to the right place.

So I can select them with:

$links = $browser->elements('#link-list a');

And then I set up a loop to click each

foreach ($links as $link) {
    $link->click();
    $browser->assert('I see what I want');

BUT The first link works fine, but the next ones do not, because I have changed the page we are on by clicking the link. So how do I retain the original context, so that my loop with the elements can work? It also doesn't work to just go back to the previous url, because the elements are tied to the original page query, not to the newly loaded version of it.

Thanks in advance for any thoughts on this.

23 Mar
2 years ago

TonsOfLaz left a reply on Can I Run Laravel Dusk On My Forge Server?

User amochohan on this page: https://github.com/laravel/dusk/issues/50

Has typed a series of (complicated) steps that worked for me! Thank you

# makes sure all your repos are up to date
sudo apt-get update
# chrome dependencies I think
sudo apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
# chromium is what I had success with on Codeship, so seemed a good option
sudo apt-get install chromium-browser
# XVFB for headless applications
sudo apt-get -y install xvfb gtk2-engines-pixbuf
# fonts for the browser
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
# support for screenshot capturing
sudo apt-get -y install imagemagick x11-apps

# Once all this has run through, you need to fire up xvfb on your homestead box. If you’re planning to # do this on a regular basis, you’ll want to get this setup on boot, but for the sake of testing things out:
Xvfb -ac :0 -screen 0 1280x1024x16 &

TonsOfLaz started a new conversation Can I Run Laravel Dusk On My Forge Server?

Hi, I have been trying for a few days to get Laravel Dusk to run on my new Forge server (php 7.1, just provisioned, etc). My workflow includes a staging environment on the Live server, so i would like to be able to run my tests there.

Is there an accepted way to do this? With default settings, I get the error:

Failed to connect to localhost port 9515: Connection refused

I have tried a few things, but no success so far. Have you found a reliable way to do this? Thanks

24 Jan
2 years ago

TonsOfLaz left a reply on Can I Sort My Group Names After Grouping?

@jlrdw The problem is that this is on the collection, not the QueryBuilder, so orderBy doesn't exist.

TonsOfLaz left a reply on Can I Sort My Group Names After Grouping?

I have not found a one-function way to do it, but here is the best workaround I have so far

$collection = $collection->groupBy($groupby);
$collection_arr = $collection->all();
ksort($collection_arr);
$collection = collect($collection_arr);

If it doesn't exist yet, I would love to see a ksort for collections, without these extra steps! Maybe there is still a better way than this, but using the all() function and ksort has worked for now.

TonsOfLaz started a new conversation Can I Sort My Group Names After Grouping?

Is there a built-in way to order my objects after grouping them?

Basically, I have a collection of object I have just grouped by a category. But I need to display the categories in alphabetical order. ksort gives an error because it needs an array, but converting to an array ruins the objects in the grouped collections. Here is the dd of my collection:

Collection {#973 ▼
  #items: array:28 [▼
    "Transportation Vehicles" => Collection {#938 ▶}
    "Corrections" => Collection {#949 ▶}
    "Criminal Law" => Collection {#943 ▶}
    "Education" => Collection {#929 ▶}
    "Taxes Business" => Collection {#948 ▶}
    "Judiciary" => Collection {#944 ▶}
    "Environment & Nature" => Collection {#951 ▶}
    "Public Employees" => Collection {#952 ▶}
    "Welfare" => Collection {#953 ▶}
    "Government Contracts" => Collection {#954 ▶}
    "Government Organization" => Collection {#955 ▶}
    "" => Collection {#956 ▶}
    "Professions & Licensure" => Collection {#957 ▶}
    "Taxes Sales" => Collection {#958 ▶}
    "Government Regulation" => Collection {#959 ▶}
    "Veterans & Military Affairs" => Collection {#960 ▶}
    "Cemetery & Funeral Services" => Collection {#961 ▶}
    "Transportation General" => Collection {#962 ▶}
    "Taxes Property" => Collection {#963 ▶}
    "Utilities" => Collection {#964 ▶}
    "Banking & Credit" => Collection {#965 ▶}
    "Public Finance" => Collection {#966 ▶}
    "Insurance Health" => Collection {#967 ▶}
    "Campaigns & Lobbying" => Collection {#968 ▶}
    "Estates & Trusts" => Collection {#969 ▶}
    "Health Care" => Collection {#970 ▶}
    "Alcoholic Beverages" => Collection {#971 ▶}
    "Family Law" => Collection {#972 ▶}
  ]
}

Is there anything like $collection->keySort()? I have not been able to find anything.

Thanks in advance!

23 Jan
2 years ago

TonsOfLaz left a reply on Can I Log In My App As A Single Twitter User?

Thank you for the consideration, @DmytroOlefyrenko ! The package you linked to did work exactly as expected. It even had an example of what I was trying to do in the docs:

\Codebird\Codebird::setConsumerKey('YOURKEY', 'YOURSECRET'); // static, see README

$cb = \Codebird\Codebird::getInstance();

You may either set the OAuth token and secret, if you already have them:

$cb->setToken('YOURTOKEN', 'YOURTOKENSECRET');

This example sets the App to use a single twitter account, with no login required by the user. This is great.

BUT....

It turns out the original package I was using also does this by default. The thujohn/twitter package (https://github.com/thujohn/twitter) apparently does the same thing if you provide the TWITTER_ACCESS_TOKEN and TWITTER_ACCESS_TOKEN_SECRET in the .env file.

It never says it anywhere (that I can find) in the docs, but if you never authenticate another user, it just assumes you are using the user with those access tokens, and you can tweet/make api calls as that user.

Maybe everyone knew this, but I only found it by accident, and couldn't find other people with the same use case. I hope this helps someone in a similar situation!

19 Jan
2 years ago

TonsOfLaz left a reply on Can I Log In My App As A Single Twitter User?

Hi @DmytroOlefyrenko , I looked into Socialite, but it always seems to be for authenticating the user's own twiter account. I haven't seen any way for the app to authenticate its own twitter user. It seems that it should be possible, but I haven't figured out how yet.

18 Jan
2 years ago

TonsOfLaz started a new conversation Can I Log In My App As A Single Twitter User?

Hi,

I have a project I am working on where I need multiple people to have access to the SAME twitter account. I thought it would be pretty straight forward to log my app in as a single twitter user, but every tutorial or instruction set I look at is just about each user logging in as their own user.

I am using the thujohn package (https://github.com/thujohn/twitter), but I would gladly use any package that could make this work.

Can this be done? Thanks in advance!

14 Jan
2 years ago

TonsOfLaz started a new conversation How Can I SSH Into Forge Using Laravel Remote?

Hi, I have a command I want to run from my local environment on the production server. It seems like Laravel Remote is the perfect solution to this: https://laravelcollective.com/docs/5.3/ssh

But when I try to make it work, I get "Connection refused."

'connections' => [
        'production' => [
            'host'      => 'my.ip.add.ress',
            'username'  => 'forge',
            'password'  => '',
            'key'       => '',
            'keytext'   => '',
            'keyphrase' => '',
            'agent'     => '',
            'timeout'   => 120,
        ],
    ],

I have already set up my local environment with an ssh key, and I regularly log into my Forge server. Pasting the id_rsa into the "key" of that form did not work.

Has anyone else done this successfully? Any ideas what I can do here? Thanks in advance!

30 Dec
2 years ago

TonsOfLaz started a new conversation Can't Update Queued Job Code, Job Fails On Non-existent Code

I have a very strange issue. I have a Queued Job (SendDailyUpdate) running to send emails. I get this in the failed_jobs table:

BadMethodCallException: Call to undefined method Illuminate\Database\Query\Builder::admins() in /home/forge/site.com/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2450
Stack trace:
#0 [internal function]: Illuminate\Database\Query\Builder->__call('admins', Array)
#1 /home/forge/tls.mleesmith.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1469): call_user_func_array(Array, Array)
#2 /home/forge/site.com/app/Jobs/SendDailyUpdate.php(45): Illuminate\Database\Eloquent\Builder->__call('admins', Array)
#3 [internal function]: App\Jobs\SendDailyUpdate->handle()

So it was failing on this line in SendDailyUpdate, on line 45:

$users = User::someScope()
                     ->admins()
                     ->orderBy('email')
                     ->get();

This uses the scopeAdmins() function in the User class, which works in other places. But that's not the strangest part. I REMOVED the function entirely, so it is just:

$users = User::someScope()
             ->orderBy('email')
                     ->get();

And the Queued Job still fails on the same line and error. So it still says that it can't find the admins() method.

The admins() function is no longer used. I tried changing the file completely, and it still fails on the exact same error.

What on earth is going on here? Is the queue using some weird cached version of old code? I have verified that the code is updated, and there is a complete mismatch in what the queue error is telling me and the actual file in the repo.

Thanks in advance for any ideas.

22 Dec
2 years ago

TonsOfLaz left a reply on What's With Commenting Out Providers On Composer Update??

@clay Great, thanks! It seems that my use of composer update is the issue here. I always default to that, as I thought install was only for a first time installation. From now on, I will use composer install, as everyone else must be!

Awesome

TonsOfLaz left a reply on What's With Commenting Out Providers On Composer Update??

no, not running them on the vm.

It seems like a Catch 22 to me. You get an error running composer update if the package isn't in the vendor folder: you can't get the package in the vendor folder without running composer update.

But if nobody else is experiencing this then I have no idea what everyone is doing differently.

TonsOfLaz left a reply on What's With Commenting Out Providers On Composer Update??

Yeah, I verified that bootstrap/cache/services.php is not in the repo. Doesnt it find the new provider i added in the config/app.php, and look at the vendor folder for everything in there?

TonsOfLaz left a reply on What's With Commenting Out Providers On Composer Update??

Thanks for your time on this issue, but I am not sure that would be it.

I am using Laravel/Forge defaults for all items, including the .gitignore for the bootsrap/cache directory. And it isn't just an issue of deployment (I have auto-deploy in forge after pushing to master branch), it happens if I ever add a new package to my app and try to pull it onto another computer and run composer update to pull the package in.

Just to be clear: when you

  1. add a new package using composer require, and
  2. add it to the providers array in config/app.php
  3. commit and push
  4. pull into cloned repo
  5. run composer update

You get no error? How does it resolve the non-existent class (i.e. Yajra\Datatables\DatatablesServiceProvider::class) listed in the config/app.php providers array? On mine just having that line in there without the corresponding vendor folder causes a fatal error.

TonsOfLaz left a reply on What's With Commenting Out Providers On Composer Update??

@ejdelmonico Ah interesting.. so in my composer.json file, I could add something to the autoload section?

"autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },

I dont see any examples of other packages added here. Is that something that can be added when I first run the require command? Thanks for your assistance, this is something that has bothered me for a long time and I can't imagine other people are dealing with or there would be more discussion of it

TonsOfLaz left a reply on What's With Commenting Out Providers On Composer Update??

@ejdelmonico Yes, I use composer require somepackage

It's not that the package isn't loading correctly. It is. Its that when I pull into the next repo, or the production server, i have to go through the process of commenting out the Providers before I can run composer update.

TonsOfLaz left a reply on What's With Commenting Out Providers On Composer Update??

@clay So when you push code from your dev repo to your production environment, you go through the same procedure of commenting things out on the production server then commenting them back in?

I generally avoid making any code modifications directly in production, which is why this seems so foreign to me.

TonsOfLaz left a reply on What's With Commenting Out Providers On Composer Update??

Updated to show composer.json require

Is this not something everyone else is familiar with? I really don't understand, I have to do this every time I add a new package and pull code to another repo.

TonsOfLaz started a new conversation What's With Commenting Out Services On Composer Update??

I apologize if this has been answered and discussed, I couldn't find the right keywords.

Every time I add a new package to my system in one place, I pull the code to the other place, run composer update, and I get a fatal error like:

`PHP Fatal error: Class 'Yajra\Datatables\DatatablesServiceProvider' not found in / vagrant/public/laravel5/vendor/laravel/framework/src/Illuminate/Foundation/....etc etc on line 150'

So of course, composer update can't run with this fatal error, which is caused by not having the files in the vendor folder that composer update will put there. It is a Catch 22. So I have to go into the config/app.php file, and comment out the new Provider:

'providers' => [

        // Yajra\Datatables\DatatablesServiceProvider::class,

Then I can run composer update, which installs the class in the vendor folder, and THEN I can comment that line back in and all is well.

This seems completely wrong to me, yet I have done it every time I add a new package, and I have to do it on the Live site. This is the worst part of my setup.

What is going on? What am I doing wrong? What does everyone else do?? It can't be this. Thanks very much

02 Nov
2 years ago

TonsOfLaz left a reply on Can I Sort The GroupBy Collection Keys?

Ok, so I did not find a way to sort the groupBy keys, but I did find a pretty easy workaround. If you sort the list by the same value as the groupBy first, then the grouped list will have the correctly sorted keys:

    $my_objects= MyObject::with('category')
                                  ->get();
                       
        $my_objects = $my_objects->sortBy('category.name');           
        $my_objects = $my_objects->groupBy(function ($item, $key) {
                        if ($item->category) {
                            return $item->category->name;
                        } 
                    });

TonsOfLaz left a reply on Can I Sort The GroupBy Collection Keys?

Hi @jlrdw , thanks for the reply. When you groupBy in the querybuilder, you lose objects (because all objects within each group are condensed down to one from that group). So I need to do it in the Collection after I have retrieved all the correct objects.

TonsOfLaz started a new conversation Can I Sort The GroupBy Collection Keys?

Hi, I have a collection I wanted to group by a category, like so:

$my_objects->groupBy(function ($item, $key) {
                        if ($item->category) {
                            return $item->category->name;
                        }
}

That comes back correctly grouped, i.e:

[
  ['Government'] => [3 objects],
  ['Education'] => [12 objects]
]

But I need to display the categories in alphabetical order. I cannot for the life of me figure out how to sort these keys without manually doing it (which i can do, but i need to this elsewhere so would prefer not to). I don't want to convert to an array and use ksort either, because I need to have the objects still.

Is there an easy way to do this with Collections I am missing? Thanks in advance for any help.

25 Oct
2 years ago
09 Sep
2 years ago

TonsOfLaz left a reply on Console Command Called From The Web Dies Early

I use the scheduler for many items (without a queue) as well, but this one needs to run only when the Admin clicks to run it. Is there a way to use the scheduler to kick something off on demand without using queues?

I can think of a convoluted way of doing it, where some flag is set and the scheduler checks every minute for the flag, but that has its own complications and I would prefer to just run a script on a click if it is possible.

TonsOfLaz left a reply on Console Command Called From The Web Dies Early

Hi @nate.a.johnson , thatnks for the reply. I kick off the job with an ajax call, and set it to not abort when the window is closed, so it shouldn't tie up the browser at all.

I have avoided using queues so far, and would prefer not to unless absolutely necessary. I have had issues with serialization of object not working correctly when the queued jobs run, so I didn't want to have to wrestle with that with a process that already works.

If it is impossible to let a php process run for 20 minutes in the background, so be it. But I didn't think that was the case.