andyjh07

Member Since 3 Years Ago

Chatham, Kent

Web Developer at PB, Maidstone

Experience Points 13,495
Experience Level 3

1,505 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 198
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

15 May
2 months ago

andyjh07 started a new conversation Laravel Mix IE11 Babel Issues

I'm currently trying to install Laravel Mix inside a WordPress project to handle my asset compilation.

I have my webpack.mix.js file set up as follows:

let mix = require("laravel-mix");

mix.babel("src/js/app.js", "dist/js/app.js")
    .sass("src/scss/style.scss", "dist/css/style.css")
    .sourceMaps()
    .setPublicPath("dist");

I also have a .babelrc set up as follows:

{
    "presets": [
        [
            "@babel/preset-env",
            {
                "targets": {
                    "ie": "11"
                }
            }
        ]
    ]
}

The only code I'm currently using inside app.js is this:

import Vue from "vue";

However, when I go to the page I get the following error:

Uncaught ReferenceError: require is not defined at app.js:3

And file compiled looks like this (the issue apparently lies on the var _vue line):

"use strict";

var _vue = _interopRequireDefault(require("vue"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

I'm really stuck on this issue as I'm unsure what to do. Any ideas appreciated!

07 Mar
1 year ago

andyjh07 left a reply on Install Wordpress From Git Repo?

@nathangross I achieved this using the Bedrock Wordpress installation, it's up and running nice and easy :)

19 Feb
1 year ago

andyjh07 left a reply on Wordpress, Forge & Version Controlled WP Themes

Thanks @sutherland this'll be tonights project :)

andyjh07 left a reply on Wordpress, Forge & Version Controlled WP Themes

@sutherland good shout dude, I totally forgot about Bedrock. What would be the process for setting up the Forge account with it? Do I create a site as a standard PHP/Laravel site or still set up as Wordpress?

Thanks for the reminder :)

andyjh07 started a new conversation Wordpress, Forge & Version Controlled WP Themes

Hey friends,

I'm currently developing a Wordpress site for my photography and I'm using Git to control the theme files. I know that I can set Wordpress up on Forge which is awesome, but how can I go about setting my server up to read from the theme's repo?

Do I need to do anything specific with the deploy script or will it work fine out of the box so to speak if I reuse a deploy script from one of my Laravel sites? I've not installed WP on Forge before.

Thanks in advance for any guidance :)

Andy

06 Feb
1 year ago

andyjh07 left a reply on Install Wordpress From Git Repo?

@nathangross I haven't yet I'm afraid, I need to take another look into it. Let me know if you find anything :)

24 Jan
1 year ago

andyjh07 left a reply on Install Wordpress From Git Repo?

@alenabdula I know this question is old but what's the best way to set up automated pull when listening to the master branch when working with git controlled themes in Wordpress? I'm about to set my Forge up the same way you suggested above

13 Dec
1 year ago

andyjh07 left a reply on Tightening Up Security For An Upcoming App Idea

@36864 oh... yeah, you totally just blew my mind with something simple hahaha. Good shout

andyjh07 left a reply on Tightening Up Security For An Upcoming App Idea

@36864 If they're stored in a table, with a foreign key, does that not then make an obvious correlation with what user it belongs to? If only the database is compromised, they can decrypt everything right? But if one key was stored in the .env, and they didn't get access to that (just the DB) the data would be useless - right? I know it's a lot of what if's though haha.

Yeah I use Spatie's Laravel-Permission in a couple of projects already, works really well :)

No worries on the JWT, new ground for me too haha

andyjh07 left a reply on Tightening Up Security For An Upcoming App Idea

@bashy haha thanks dude, much appreciated :)

@36864 Aye, I definitely don't assume it's safe from any attack because it's encrypted; but it's saf_er_ with the encryptions.

I have thought about trying to work out how to use unique keys for each user, but is there a simple way to pass each user's key on the request etc rather than using the global? I was originally going to use a trait to encrypt/decrypt.

It's hard to share anymore than I already have at this point in time: I'd like the details of users, those user's clients and any associated jobs/files to be encrypted so that they aren't plain text - one box ticked when it comes to security.

I'll also want to roll JWT or similar into it so the API can be consumed by an app.

Just want to get a little bit of a clear picture on a good place to start so I don't need to rewrite the app a couple of times - though sometimes that's required

andyjh07 left a reply on Tightening Up Security For An Upcoming App Idea

@bashy haha ah yeah, that was my reptile genetics calculator :P I saw your laptop skin on Twitter a while back, was meant to tweet you to see where you got it as I'd forgotten.

This is true, this particular project needs a lot of thought overall. I'm going to look into how to really lock down a server and keep that key as safe as possible - If any of you guys have recommendations on securing linux or similar I'm all ears.

Thanks for the suggestions so far, really don't want to go down one path with this and then have to totally rewrite it haha

andyjh07 left a reply on Tightening Up Security For An Upcoming App Idea

@bashy Ah dude I wondered if you'd ever see me post on here, blows my mind we're in the same building haha.

I'll take a look at the suggestions and see what we can do. Can any of you see any immediate issues with what I'm proposing at all? Is encrypting multiple columns going to cause me some speed issues or will it be negligible?

Easy to get an idea and run before you walk so doing my best to do this properly :P

andyjh07 started a new conversation Tightening Up Security For An Upcoming App Idea

Hey guys,

I've got a little system that I plan to work on soon (which when its ready will be released worldwide), but I want to try and make the data that's stored in the server as secure as possible. We will be capturing user details (name, email, password etc.), details of their clients (name, address, email etc.) and then details of jobs for those clients (job number, description etc.). There will also be PDF contracts created that have a digital version of the user & client signatures

We will be using Stripe for payments to us, and perhaps offer it as a platform for user's to be paid via Stripe from their clients - so not too much of a worry there as we can leverage Stripes API.

I know that I can use Crypt::encrypt and Crypt::decrypt which utilises the key stored in the .env - is this enough security inside the application itself, or are there other things that I should look into?

Also, what steps should I take when setting up a server for this kind of application - would something like AWS be a good option? I usually just use linux servers with mysql but looking to use a better stack as I feel like I'm using an archaic setup.

Thanks in advance for any advice on this,

Andy

17 Feb
2 years ago

andyjh07 started a new conversation Will The "How To Accept Payments" Series Be Updated To Reflect Stripe's Changes?

Hey @Jeffrey,

I was browsing twitter this morning and saw that Adam Wathan tweeted about the changes to Stripe.js. Will this be reflected in upcoming episodes of the series?

https://stripe.com/docs/elements/migrating

Thanks for all you do on Laracasts :)

Andy

15 Nov
2 years ago

andyjh07 left a reply on Laracasts Refresh

omfg this design is so good

17 Oct
2 years ago

andyjh07 left a reply on Modify Authenticated() Method Inside AuthenticatesUsers.php Class

@tomi did you see the bit about git ignored? It won't show up on the server as it's a vendor file

andyjh07 started a new conversation Modify Authenticated() Method Inside AuthenticatesUsers.php Class

Hi guys.

I'm looking for the correct way to modify the authenticated() method inside the \Illuminate\Foundation\Auth\AuthenticatesUsers.php file.

I don't want to just modify this file as the changes won't reflect on the server, as it's inside the vendor folder which is git ignored.

I've not had to modify a core method before so don't know the best way to do this? Any advice is appreciated :)

Andy

14 Oct
2 years ago

andyjh07 left a reply on Stripe New Tutorial For 5.2

@darrynsmith Looks like you don't need to wait any longer ;)

12 Oct
2 years ago

andyjh07 started a new conversation Laravel Passport Questions

Hey friends,

I've set up a central app (let's call this maindomain.com), where I've setup Passport. This site will be where users register to gain access to all other apps I create.

To test it out, I've followed (Matt Stauffer's blog post)[https://mattstauffer.co/blog/introducing-laravel-passport] to create a client app that will use the user data stored on maindomain.com, let's call this app1.com.

I can confirm that my callback and whatnot work fine. When you go to app1.com/login (as per my route) it redirects to maindomain.com and allows you to authorise app1.com to use your login details - beautiful.

As per Matt's post, right now it prints the token to the screen. I need to change this so that it saves to the database - I assume I should just create a column on my user's table and store it there?

I've tested the token and can access the API routes using PostMan. However, because at the moment I'm creating web apps that all need to use this centralised user system, I'm not sure how I can use a login form to authorise users and allow them access to their dashboard.

If user's are logging into app1.com do I send a POST request to maindomain.com? Isn't that going to be a problem with CSRF? I've read the documentation but as this is my first venture into oauth2 I am pretty confused.

If you guys can help me out at all I'd seriously appreciate it :)

Andy

11 Oct
2 years ago

andyjh07 left a reply on Is There Any Way To Run `php Artisan` On Forge?

Wow holy crap I totally forgot to run composer install. Thanks for that @tykus_ikus, now I feel stupid ;)

andyjh07 left a reply on Is There Any Way To Run `php Artisan` On Forge?

@shez1983 Ah yeah, I know I could do it in the deploy script but is that the only place this can be done? I was trying to do this as sudo via SSH

andyjh07 started a new conversation Is There Any Way To Run `php Artisan` On Forge?

I'm spinning up some new servers and on one of the sites I want to put it in maintenance mode - I planned on using php artisan down but forge doesn't allow it saying Could not open input file: artisan.

How on earth do I go about doing this?

08 Oct
2 years ago

andyjh07 left a reply on One Login For Multiple Sites

@ssuresh yeah, that's exactly the same situation. I think that's what Passport allows to do now so I'll be looking into that I think. Thank you :)

andyjh07 left a reply on One Login For Multiple Sites

But if you go to another one of the sites (where no login session exists), how would you login?

andyjh07 started a new conversation One Login For Multiple Sites

Hey friends,

I've got a couple of apps I'm building on Laravel. They are all going to be separate systems, likely on separate servers but part of one "ecosystem". I have a goal of allowing people to sign up on any of the sites that I create, and that login can then be used on any of the other sites.

Is this the sort of thing Passport is used for? If so, what's the best way to implement it? Should I pick just one site and make that the "main" user database, or spin up a single app just for holding all the user data?

Thanks in advance for your feedback/ideas,

Andy

25 Sep
2 years ago

andyjh07 left a reply on 'Minimize Redirects' When Using SSL On Forge

@Spex That's what I thought, thanks for the response :)

24 Sep
2 years ago

andyjh07 started a new conversation 'Minimize Redirects' When Using SSL On Forge

Hey guys,

I've got a couple of sites on Forge that have LetsEncrypt enabled, neither of them are Laravel at the minute. When I run them through https://tools.pingdom.com they always come back with this warning:

#Remove the following redirect chain if possible: http://reptimate.com/ https://reptimate.com/

Is it possible to fix this or is it just not worth worrying about?

Andy

24 Jun
3 years ago

andyjh07 left a reply on What Is The Correct Approach To Adding Extra Fields To Spark's Registration Form?

@zaffarsaffee Yes unfortunately, this is based off of experimentation due to lack of documentation in the beginning. Taylor has now added this as a cookbook tutorial on the Spark documentation with the proper implementation

14 Jun
3 years ago

andyjh07 left a reply on Integrating Socialite With Spark

Could well be a better way of doing it than my way. I just tied it into the already existing LoginController but honestly didn't think about the impact of updates. The rest of what I did is incredibly similar to your own except I just put the token for Facebook and Twitter into a column on my Users table.

Did you just make your Socialite routes point to your new SocialAuthController and handle all the Socialite stuff there? Seems like a much cleaner way of doing it ;)

A lot of my spark work is experimentation at the moment as I couldn't find any good docs on integrating Socialite properly or creating additional registration fields, but Taylor has created a little cookbook for that bit now ;) haha.

13 Jun
3 years ago

andyjh07 left a reply on Integrating Socialite With Spark

Sorry all, have been on holiday in Portugal. I'll go through my files tonight but not a lot is actually different to how you would usually implement Socialite to a Laravel app.

I can confirm that Socialite works with Spark, quite nicely too.

Andy

14 May
3 years ago

andyjh07 left a reply on What Is The Correct Approach To Adding Extra Fields To Spark's Registration Form?

Okay I finally stumbled across it :D

In Laravel\Spark\Interactions\Auth\CreateUser.php there is a $rules method like so:

public function rules($request)
    {
        return [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
            'vat_id' => 'max:50|vat_id',
            'terms' => 'required|accepted',
        ];
    }

All I have done is add my username field, and it works brilliantly!

public function rules($request)
    {
        return [
            'name' => 'required|max:255',
            'username' => 'required|unique:users',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
            'vat_id' => 'max:50|vat_id',
            'terms' => 'required|accepted',
        ];
    }

andyjh07 left a reply on Cannot Find A Way To Make Spark Register Fields Show Errors?

Okay I finally stumbled across it. In Laravel\Spark\Interactions\Auth\CreateUser.php there is a $rules method like so:

public function rules($request)
    {
        return [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
            'vat_id' => 'max:50|vat_id',
            'terms' => 'required|accepted',
        ];
    }

All I have done is add my username field, and it works brilliantly!

public function rules($request)
    {
        return [
            'name' => 'required|max:255',
            'username' => 'required|unique:users',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
            'vat_id' => 'max:50|vat_id',
            'terms' => 'required|accepted',
        ];
    }

andyjh07 started a new conversation Cannot Find A Way To Make Spark Register Fields Show Errors?

I've added a new field to my form. But I can't find where to set the errors so that my new username input must be unique.

I've spent hours trying to work this out and I'm really quite stuck :(

Andy

13 May
3 years ago

andyjh07 started a new conversation What Is The Correct Approach To Adding Extra Fields To Spark's Registration Form?

Hi all,

I'd like to add some extra fields to my Spark registration form but can't find anything in the docs explaining how to do this. Can anyone point me in the right direction on what I need to alter in order for the new fields to work? For example I'd like to add a username field so that users can log in with either their username and password or email and password.

Thanks in advance!

Andy

andyjh07 left a reply on Integrating Socialite With Spark

The answer is no, not really lol. I just used LoginController to control all the Socialite stuff, updated my routes, job done.

12 May
3 years ago

andyjh07 started a new conversation Integrating Socialite With Spark

Hi all,

I've got Socialite working on my "standard" Laravel App. I'm just wondering if the way to integrate Socialite into a Spark based App is exactly the same process? I've noticed that Spark uses a different AuthController file which I think is called LoginController. Apart from that, is there much different?

Cheers, Andy

04 May
3 years ago

andyjh07 started a new conversation "Sign In" Link Gets Lost In Header When Previously Visited

Hey Jeffrey, Just noticed that the contrast seems a little off for the previously visited "Sign In" link in the header. I almost missed it ;)

Andy

andyjh07 left a reply on Reviewing My Routes, Do They Make Sense?

@frezno Thanks for that info, I think I'll restructure my routes file today as I wasn't aware that was available haha.

@Snapey The logic behind naming is all sorted don't worry. My system is working well, I'm just crap with knowing the best way to do the API.

I think your suggestion of /gecko/images/{gecko_name}/upload is good, would you also do something like /gecko/images/{gecko_name} in order to view a gallery?

Thanks for your feedback guys, trying to think of a logical route is difficult at times haha.

03 May
3 years ago

andyjh07 left a reply on Reviewing My Routes, Do They Make Sense?

@Snapey Sorry about the lack of formatting ;)

The reason the other routes are there is because I want to use the name variable in my controller

andyjh07 started a new conversation Reviewing My Routes, Do They Make Sense?

Hi everyone,

I'm still working on my first Laravel app - it's a reptile tracker app. Anyways I'm still trying to understand the best way of doing RESTful routes, below are my current routes:

// Weight routes... Route::resource('weights', 'WeightController'); Route::get('weights/{gecko_name}/create', 'WeightController@create');

// Gecko routes... Route::get('geckos', 'GeckoController@index'); Route::resource('gecko', 'GeckoController'); Route::get('gecko/{gecko_name}/view', 'GeckoController@show'); Route::get('gecko/{gecko_name}/edit', 'GeckoController@edit');

So to give you an idea, a couple of the routes could be:

app.dev/gecko/Zilly/view app.dev/gecko/Zilly/update app.dev/weights/Zilly/create

And I want to implement some image uploads, so I'm thinking the following routes: app.dev/gecko/Zilly/images app.dev/gecko/Zilly/images/upload app.dev/gecko/Zilly/images/delete

Have I got my endpoints correct? Does the way I'm doing things make sense or could I make them better/more understandable?

I appreciate any help with this stuff,

Andy

21 Oct
3 years ago

andyjh07 started a new conversation Submitting Array In Laravel Gives Error - Preg_replace(): Parameter Mismatch, Pattern Is A String While Replacement Is An Array

I'm trying to use the following in my application:

    <div class="form-group">
        <label for="genetics">Bell Albino</label>
        <select name="genetics[]" class="form-control">
            <option>N/A</option>
            <option value="BA">Visual</option>
            <option value="ba">Recessive</option>
        </select>
    </div>
    <div class="form-group">
        <label for="genetics">Tremper Albino</label>
        <select name="genetics[]" class="form-control">
            <option>N/A</option>
            <option value="TA">Visual</option>
            <option value="ta">Recessive</option>
        </select>
    </div>

Which you would assume works okay, however when I try submitting my form, I get the error:

preg_replace(): Parameter mismatch, pattern is a string while replacement is an array

This is my model, not sure if it will help:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Gecko extends Model
{
    /**
     * Fillable fields for a gecko
     * @var array
     */
    protected $fillable = [
        'name',
        'aquisition_date',
        'morph',
        'sex',
        'genetics',
        'bio',
        'bred',
        'hatchling',
        'clutch',
        'user_id'
    ];

    /**
     * A gecko has many photos
     * @return \Illuminate\Database\Eloquent\Relations\HasMany;
     */
    public function photos()
    {
        return $this->hasMany('App\GeckoPhoto');
    }

    /**
     * A gecko has many weights
     * @return \Illuminate\Database\Eloquent\Relations\HasMany;
     */
    public function weights()
    {
        return $this->hasMany('App\Weight');
    }
}

The store method:

public function store(GeckoRequest $request)
{

    Gecko::create($request->all());

    flash()->success('Success!', 'Your gecko has been added to the system');
    return redirect()->action('GeckoController@show', [$request['name']]);
    
}

The GeckoRequest file:

<?php

namespace App\Http\Requests;

use Auth;
use App\Http\Requests\Request;

class GeckoRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'morph' => 'required',
            'sex' => 'required',
            'genetics' => 'required',
            'name' => "required|unique:geckos,name,NULL,id,user_id," . \Auth::user()->id
        ];
    }
}

All it saves into the database is the word Array.

I'm sure it's super simple, but I'm unsure on how to fix it

18 Oct
3 years ago
17 Oct
3 years ago

andyjh07 started a new conversation Laravel 5.1 Don't Allow Duplicate Gecko Name For Current User

I have a situation with my app and I shall do my best to explain what it is i'm trying to do.

In my migration, I made my gecko name column unique ($table->string('name')->unique()). This obviously means that gecko names must be unique across the board for all users - this isn't what I want to do, I want to make sure that the current user cannot use the same name for another gecko.

For example:

If user 1 makes a gecko called Bob and user 2 made a gecko called Bob that would be fine.

If user 1 made a gecko called Bob, and then made another gecko called Bob - This wouldn't be fine.

What is the best way/practice to make this work?