ahuggins

Hire Me

Experience

229,160

34 Best Reply Awards

  • Member Since 3 Years Ago
  • 1110 Lessons Completed
  • 1 Favorite

17th October, 2017

ahuggins left a reply on Adding Username To Database(migration) Using Auth::user • 2 days ago

You could do something like this:

\\PostController.php

 public function store(Request $request)
    {
        request()->validate([
            'post' => 'required',
            'location' => 'required',
        ]);

        Auth::user()->post()->create($request->all());

        return redirect()->route('post.index')
                        ->with('success','Post created successfully');
    }

And you would have to add a relationship on your User model for post(). Something like:

\\ App\User.php

public function post()
{
    return $this->hasMany(Post::class, 'username', 'username');
}


This assumes that you have a username column on both your User and Post models.

16th October, 2017

ahuggins left a reply on Call To Undefined Method Laravel\Lumen\Application::booted() • 3 days ago

The Lumen Application class doesn't have the booted() method, which the Propaganistas package is looking for. You could extend the Application class that comes with Lumen and add a booted method that takes a call back and ties the passed callback to the Container...Might want to look at the Laravel Application class to see how it works:

https://github.com/laravel/framework/blob/5.5/src/Illuminate/Foundation/Application.php#L802-L809

But you would also have to use the isBooted() method, and maybe some other things.

24th July, 2017

ahuggins left a reply on Testing Custom Artisan Command • 2 months ago

use the Artisan Command to generate a test like php artisan make:test NameOfYourTest Or actually @themsaid probably explains it better here: https://themsaid.com/building-testing-interactive-console-20160409/

28th June, 2017

ahuggins left a reply on Nothing Showing, No Login, No Page, No Errors. • 3 months ago

@Cronix You can make PR to the Spark docs?

22nd June, 2017

ahuggins started a new conversation Nothing Showing, No Login, No Page, No Errors. • 3 months ago

Posting this in case anyone else experiences this.

I think I had an older version of Spark, and tried to upgrade, but then the app wouldn't show anything. No pages, and very curiously, no errors in the console.

Eventually I tracked it down to something involving the v-cloak directive. No link was turning up anything that was explaining what was happening. So I did a fresh install of Spark and everything was working. So I began trying to find what was causing the problem.

Looks like Spark was built before Vue 2.0, and was using inline-templates, and maybe there was another change that the v-cloak directive needs to be on the actual Vue instance div.

In older versions of Spark, the v-cloak directive was on the body tag, and moving it to the the spark-app div, then the site begins appearing again.

Unfortunately, this does not seem to be mentioned in the upgrade guide.

12th June, 2017

ahuggins left a reply on Can't Find My Mailable Class In Controller • 4 months ago

you try a composer dump-autoload?

Figure you have, but also didn't say it, so worth asking. It looks right, so I would try the dump autoload and see if that helps

29th May, 2017

ahuggins left a reply on How To Insert Multiple Rows With Multiple Fields • 4 months ago

What about just this:


foreach ($inputs as $input)
            {

                StudentMark::create(array(
                    'course_id'=>Input::get('course'),
                    'semi_written_test'=>$input['written'],
                    'semi_reading_test'=>$input['read'],
                    'semi_class_activity'=>$input['activity'],
                    'semi_homework'=>$input['homework'],
                    'semi_total'=>$input['total'],
                    'student_id'=>$input['studentId'],
                ));
            }
StudentMark::create($marks);


It's not the best, since you are making a full roundtrip request for each $input....but it should at least create it in the db. Then you can work toward a better solution, that doesn't make as many requests.

25th May, 2017

ahuggins left a reply on I Am Getting "This Page Isn’t Working. Localhost Is Currently Unable To Handle This Request. HTTP ERROR 500" • 4 months ago

Is this the only site on the server? Can you visit the other ones?

This looks like your local server is not running.

ahuggins left a reply on I Am Getting "This Page Isn’t Working. Localhost Is Currently Unable To Handle This Request. HTTP ERROR 500" • 4 months ago

What local server are you using?

php artisan serve

Homestead

Valet

Wamp, Mamp, Xampp, Ampps?

ahuggins left a reply on 2 Variable In 1 Foreach • 4 months ago

Are you using Eloquent Models? It looks like you are only using the Query builder. If you were using Eloquent Models, I would suggest using relationships then you can return the products and reference the relationship of the other tables you are trying to get the data of.

ahuggins left a reply on 2 Variable In 1 Foreach • 4 months ago

You have a problem in your product function. You are setting $k = within a foreach. This overwrites the $k value every time, so when in the view...there should only be one value in $k.

27th April, 2017

ahuggins left a reply on Creating A Custom Facade / Service Provider - Please Help • 5 months ago

Because someone could do this...if you remove a , it can not be from the last entry in the providers array. It needs to be one that would cause an error.

ahuggins left a reply on Creating A Custom Facade / Service Provider - Please Help • 5 months ago

Ran across this, because I experienced similar issue in 5.4. Posting it in case anyone else comes across this post.

For me, I added the package service provider in the config/app.php, like we all know to do. Kept getting that the class was not found. At some point I ran all these commands in the terminal:

composer dump-autoload
php artisan config:clear
php artisan cache:clear
php artisan clear-compiled

I think it was the config:clear, but I am not 100% sure on that.

One thing you can do is go to your config/app.php file, go to the providers array, and remove a , from the end of a line. If you refresh your browser/app, and do not get a parse error. You know that you have a cache issue.

Be sure to add the , back when you are done though.

20th April, 2017

ahuggins left a reply on Scheduler Problem • 5 months ago

crontab is mostly a Unix thing, so since you are using CMD/Windows...probably isn't going to work out for you too well.

Do you know the server software you are using? IIS, Apache, Nginx?

Are you using Wamp, Mamp, Ammps, or some other local server package?

28th January, 2017

ahuggins left a reply on Npm Install Sweetalert Missing .min.js File In Dist Folder • 8 months ago

HA, turns out, I excluded *.min.js files from being searched in Sublime, and it also doesn't show them in the file tree.

So that is why it was not showing up.

ahuggins left a reply on Npm Install Sweetalert Missing .min.js File In Dist Folder • 8 months ago

I've deleted and installed the sweetalert module a few times

ahuggins started a new conversation Npm Install Sweetalert Missing .min.js File In Dist Folder • 8 months ago

I am working on a Spark application, I run npm install and it looks like things install. But when I run gulp, the Elixir/Mix file tries to publish this .copy('node_modules/sweetalert/dist/sweetalert.min.js', 'public/js/sweetalert.min.js') but when I look in the public/js folder, there is no sweetalert.min.js file, and so I go look in the node_modules/sweetalert/dist/ folder the sweetalert.min.js file is missing too.

I go look on Github for the Sweetalert repo and it has the sweetalert.min.js file listed...so does anyone know why I am not getting the min.js file in the dist folder?

14th December, 2016

ahuggins left a reply on WYSIWYG Editor For Page Content • 10 months ago

So you are asking, how do you get your page content into a WYSIWYG editor?

Usually, you have that as a property on your Page model, where you store the html, then in the edit/create page you have your WYSIWYG editor connect to a textarea field, you store that in your db, then when you edit, you set the property as the value of the textarea and have the WYSIWYG connect to the text area again.

I've done this many times.

Also, there is not a WYSIWYG that is going to automatically handle file uploads into your Laravel app. If there is, I am unaware. Most likely there might be one that has the majority of this built in the front end side, but you will most likely have to handle the upload yourself.

12th December, 2016

ahuggins left a reply on How To Get Base Url Form Json In Laravel 5.3? • 10 months ago

Friendly reminder, you don't want your .env file in your Git repository

ahuggins left a reply on How To Get Base Url Form Json In Laravel 5.3? • 10 months ago

in the .env file, there is a key APP_URL. For your local development, you can set this to APP_URL=http://localhost where on production you would set this to the actual domain.

In your case you might want to set it to: APP_URL=http://localhost/mysystem/public but I can't say 100% that will work.

ahuggins left a reply on Laravel Socialite Throws A Fatal Error When I Cancel The Authorization Process With Facebook • 10 months ago

when Fb redirects you, it usually has a code in the url...I'm guessing when the user clicks "not now" it does not have this code in the url?

ahuggins left a reply on WhereBetween In Laravel 5 • 10 months ago

You need to make the $start and $end variables instances of Carbon...or make sure that the format matches what you have in the DB.

ahuggins left a reply on WYSIWYG Editor For Page Content • 10 months ago

I can also say, it would be unlikely that you would be able to enter Blade syntax in any WYSIWYG editor. They most likely are not programmed to process Blade.

You could try to program it yourself, but not sure what you are really trying to do in order to need this. Add some more context and people might be able to suggest more.

ahuggins left a reply on WYSIWYG Editor For Page Content • 10 months ago

What system are you using? There is not a WYSIWYG in Laravel, which package or CMS or whatever?

ahuggins left a reply on Security Check List For Laravel Production Apps. • 10 months ago

Set the APP_ENV in .env file to production

3rd December, 2016

ahuggins started a new conversation On The Laracasts Homepage The Laravel Logo Is Rotated? • 10 months ago

Is it just me or is the Larvel logo on the homepage of Laracasts rotated to the right 90 degrees?

I'm talking about the logos in the graphic underneath "It's kinda like netflix for your career!"

2nd December, 2016

ahuggins left a reply on One Controller For Multiple Models • 10 months ago

oh yeah, you would have to account for the $id

ahuggins left a reply on One Controller For Multiple Models • 10 months ago

Not sure I would recommend doing this but it could work.

You extend the base Controller, add a method show like this:

public function simpleShow($model, $view)
{
    $vocab = {$model}::find($id);
        return view($view, compact('vocab'));
}

Then in your VerbController you would have:

public function show()
{
    return $this->simpleShow('App\Model', 'view.name');
}

BTW, this is untested pseudo code, but it might work.

ahuggins left a reply on Discussion Links Not Always Showing Original Post • 10 months ago

It's probably the page GET parameter...I think when it is set to 0 you only are seeing page 0

22nd November, 2016

ahuggins left a reply on Laravel Relationship Not Working? • 10 months ago

Do you have the $cart object at that point?

15th November, 2016

ahuggins left a reply on Profile Bug • 11 months ago

It also shows the number of "best reply awards" to be the loggedIn Users as well.

ahuggins started a new conversation Profile Bug • 11 months ago

@JeffreyWay When I go to my profile, I see my experience points. But if I go to your profile, I see my experience points, but when I see your avatar I see (387,160 XP) next to your name.

I have checked a few other people's profiles, looks like there is a bug in the code on the profile where it shows the loggedIn users score, instead of the score of the person you are viewing.

17th October, 2016

ahuggins left a reply on Scheduler Has 6 Asterisks / Options Vs Linux's 5? What Is The Extra One For? • 1 year ago

@Bux The docs currently have this: ->cron('* * * * * *');

It should be able to work with 5, but I have seen questions before about it, check out this PR: https://github.com/laravel/docs/pull/2523

From the man Taylor, it supports six

ahuggins left a reply on Using Scope And Pagination In A Accessor ? • 1 year ago

I think your issue is coming from calling paginate() in your accessor.

When you do this: $model->records you are executing the query because of the paginate() call.

So if you try something like this: $model->records->search() it's going to not like it.

You could do this though: $model->applicants()->search() That should allow your search to be appended to the query.

ahuggins left a reply on How To Set Up Laravel Cashier For Multiple Users? • 1 year ago

Oh wait, you are wanting each user to have their own Stripe account so that they can charge their customers? That will be a little different then.

You would have to create a table that would store your users Stripe keys, then you would have to load the keys for the user before reaching out to Stripe. Though I am not sure people will/should provide both their secret and public keys.

ahuggins left a reply on How To Set Up Laravel Cashier For Multiple Users? • 1 year ago

In the documentation, it provides migrations for adding Stripe tokens:

https://laravel.com/docs/5.3/billing#stripe-configuration

ahuggins left a reply on Store Latex Equations In Database • 1 year ago

what does your form code look like?

what does your code for storing the info in the database look like?

You do have a field with name attribute that matches a column in your database?

ahuggins left a reply on Download Files From Storage Is Not Working? • 1 year ago

What do you get if you run this:

 if (file_exists($archive_name)) {
        dd($archive_name);
                    return response()->download($archive_name, 'test_'.$fromDate.'_'.$toDate.'.zip', $headers) /*->deleteFileAfterSend(TRUE)*/;
                }

ahuggins left a reply on Find The User Being Registered "undefined Variable User" • 1 year ago

This:

->with([
                        'token' => $user->token     // this is where it fails, line 47
                    ]);

should be:

->with([
                        'token' => $this->user->token     // this is where it fails, line 47
                    ]);

16th October, 2016

ahuggins left a reply on Where Should I Add Two Facades Shipped With The Dingo Package • 1 year ago

in the config/app.php file, in the aliases array, you should provide a key, which is how you would access the facade in your app.

15th October, 2016

ahuggins left a reply on Append Or Add Text To Existing View With A Package • 1 year ago

In your package you would want to create a ServiceProvider. Then you would have that ServiceProvider publish your assets, see this: https://laravel.com/docs/5.3/packages#publishing-file-groups

Then you would be able to edit the views that are published.

ahuggins left a reply on Fresh Spark Install: Trait 'Illuminate\Notifications\Notifiable' Not Found • 1 year ago

have you done a composer dump-autoload? Not necessarily the issue, but you didn't say you did it either, so first place to check.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.