neilherbertuk

neilherbertuk

ICT Systems Development Engineer at Keele University

Stoke-on-Trent

Member Since 3 Years Ago

Experience Points 36,100
Experience
Level
Lessons Completed 278
Lessons
Completed
Best Reply Awards 22
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.

10 Dec
4 days ago

neilherbertuk left a reply on How To Create Signature On The Place Of Parameters In Laravel 5.5?

Hi samshervarma,

Check out the Laracasts Posting Guidelines for best practices on formatting posts and providing the right information.

Your question is extremely vague and could do with being expanded upon.

Neil

08 Dec
6 days ago
07 Dec
1 week ago

neilherbertuk left a reply on Auth

Posting you code would be useful. However I'm assuming you are calling an associative array $array[Auth] you need to use quotes $array['Auth']

neilherbertuk left a reply on Session Package Advice

There are a lot of online resources that cover this, a quick Google will point you in the right direction.

I tend to use JSON Web Tokens (JWT) for this using tymon/jwt-auth for the backend auth side, you can use this as part of the built in auth mechanism. Then on the Vue side websanova/vue-auth

“API Authentication in Laravel-Vue SPA using Jwt-auth” by Olu Udeh https://link.medium.com/BLyvkvIIrS might get you started.

Neil

05 Dec
1 week ago

neilherbertuk left a reply on Strategies For Debugging Phpunit In Laravel

There are a few ways of dealing with this, using something like xdebug can be useful. Check the log files. I generally lean on the good old dd(). Start at the output of your controller and work backwards using dd until you find where your code is still executing. You can then start from the next bit of code to figure out what's going wrong.

neilherbertuk left a reply on Laravel Sereve

In reality, you'll need some way of starting your application. Whether it's using php artisan serve or installing a webserver on your desktop. There isn't really a way to launch it as a single shortcut.

neilherbertuk left a reply on Understanding Microservices

As @primordial has said, there is no definitive answer, there are lots of ways of achieving this. Microservices are a complex topic.

Each service should be as independent as possible from other parts of your system, so it should have its own data source and not rely on other parts of your application to function. Each component should be treated as its own "little black box", other services shouldn't care how it works, just that you give it data via something like a HTTP API request or an event bus and it returns an answer in an expected format or performs an action. A perfect example of this is Amazon, the Amazon landing page is suspected to be made up of over 100 different microservices. If one of them is not available, the site still renders and works, just that function doesn't appear. It could be that the review microservice is offline, the site continues to function but the reviews just don't get shown.

The key bits you'll need to think about when splitting the functions of your application out is authentication and authorisation, as well as how everything talks to each other including how they discover each other. An API Gateway (something like Kong) can take care of most of this for you.

I'd strongly recommend you have a think to whether you really do need to go down the microservices route before you start, if you do it yourself rather than going down the vendor lock-in route with something like AWS, it adds a lot of overhead, you need to make everything redundant and monitor everything to ensure smooth sailing.

Neil

neilherbertuk left a reply on Understanding Microservices

So I think it would help if you read Martin Fowler's definition of a microservice https://martinfowler.com/articles/microservices.html

The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery.

So as your code is all part of the same code base it would probably be considered a monolith. You would turn to microservices as an answer to scaling issues. Do you see a need to scale your application as it grows? Are certain areas of your application going to see more load than others? Microservices are great to let you independently scale areas of you app to handle it's demand.

neilherbertuk left a reply on Authentication In Laravel With React Front End

Hi dhraval99 ,

Check out the Laracasts Posting Guidelines for best practices on formatting posts and providing the right information.

Neil

05 Nov
1 month ago

neilherbertuk left a reply on Version Jquery

Open your jQuery js file in a text editor. It states the version number at the top.

/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
29 Oct
1 month ago

neilherbertuk left a reply on Bind

I'm assuming you are referring to JavaScript here?

https://javascript.info/bind

Neil

neilherbertuk left a reply on Updating All Previous Posts With Specific Field Being = 1

Personally I'd tackle this slightly differently. What if you wanted to know if a post had been featured at some point? What if you want to change the number of featured posts that are displayed in the future?

I would perhaps take a look at your archive query and do it there. Something like get all posts ordered by latest first, then use the reject chained method to remove the first three that are featured. You could set an environment variable or something in your config to specify how many to be displayed/removed, so you only have to change it in one place.

It's also considered best practice by a lot of developers to use timestamps instead of booleans. This way you can also see the exact time it was made a featured post. Such as you could see if it's been there for too long etc.

Neil

28 Oct
1 month ago

neilherbertuk left a reply on How To Prevent Svg To Redownload Again After Asyn Page Load

Why are you including an SVG within a PHP script? Your PHP will include it every time, and as it's a dynamic page it will be downloaded each time.

You need to tell the browser to cache it. Are you setting the appropriate headers to tell the browser to cache it?

You could let the browser taken are of it all by getting it to use the file directly.

neilherbertuk left a reply on Urgent Help - Laravel 5.4 Website -Sub Domain Redirection

Hi MANSA06,

You are going to find that very few people have the time or patients to try and decipher what such a long and improperly formatted post is asking.

Please check out Laracasts Posting Guidelines which details what makes a good post and the sort of information needed to be able to help answer you.

Please make use of markdown and spacing to help us be able to navigate your post!

Neil

neilherbertuk left a reply on Error MethodNotAllowedHttpException

First off, you've included what looks like a genuine username and password for mailtrap in your post. Always be careful copying and pasting code onto public websites! If they are real, get them changed asap!

So, apart from not understanding why you have combined your get and post methods, I don't see anything particularly wrong.

What have you tried so far? Posting a proper stack trace or error log would be helpful. Have you checked how far your code gets when it executes before it throws that?

My best guess would be that you've got opcache on or something like that. Did you start with your get method, and have added post to it after? It might be that you've got something cached somewhere. Try restarting your web server and clearing all the framework caches using php artisan.

27 Oct
1 month ago

neilherbertuk left a reply on Best Practice For Allowing User To Dynamically Set Some ENV Variables?

What sort of things are you wanting them to change in the .env file?

26 Oct
1 month ago

neilherbertuk left a reply on User ID Issue

Looks like you should check out the Laravel from Scratch course here in Laracasts, or swat up on Eloquent on the official docs https://laravel.com/docs/eloquent, especially as you asked how to get an aggregate count of a table in another posts at the same time as this.

neilherbertuk left a reply on Unable To Cache Eloquent Resource

What cache driver are you using? If its the default file driver, have you set the folder permissions correctly? It could be that your application is unable to write to the cache directory.

25 Oct
1 month ago

neilherbertuk left a reply on Why Did Not Work Js File In Laravel 5.6?

You've not really provided enough coherent information to really be able to answer you. I am purely guessing here.

First of all, you are loading multiple, different versions of bootstrap and jQuery in the code you've provided. That's likely to cause conflicts. Also, from what you've posted, it looks like your $.ready code is being run before jQuery is included. It needs to be at the bottom of the page.

Are you getting any errors in the developer console?

neilherbertuk left a reply on Ajax 405-method-not-allowed

Your Ajax call needs to send the csrf token with it.

neilherbertuk left a reply on Ajax 405-method-not-allowed

You'll need to post your ajax_cart method from your HomeController.

neilherbertuk left a reply on Ajax 405-method-not-allowed

You are making back post request, your route is a get request.

21 Oct
1 month ago

neilherbertuk left a reply on Correct Use Statement For Composer Library

You'll need to include/require the file slack.php it's look for it in the wrong folder. You'll need to be specific with its location. Probably something like:

require (base_path(vendor/simonbackx/slack-php-webhook/slack.php'));

neilherbertuk left a reply on Authorization User Or Guest Show!

You can find out about blade syntax at https://laravel.com/docs/blade

There are a few ways you can do this, with the existing code you can just do an @else

Welcome: 
@if(Auth::check())
  {{ Auth::user()->name }} 
@else
  Guest
@endif

You can also use the @auth and @guest directives instead

Welcome: 
@auth
  {{ Auth::user()->name }} 
@endauth
@guest
  Guest
@endguest

Neil

18 Oct
1 month ago

neilherbertuk left a reply on In Regards To Laravel Ffmpeg

Hi STEPHROCKS22,

That is a pretty hard question to try and answer without knowing more about the environment you are using. What steps are you planning on taking to deploy? What are you deploying on to? You'll need to make sure ffmpeg is installed. You'll also need to make sure that the account that your site runs under has permission to execute ffmpeg. If you are deploying onto a Linux system you'll need to check whether SELinix is on, and if so set permissions for that too.

Neil

14 Oct
2 months ago

neilherbertuk left a reply on Errors After Deploying Laravel/vue Project

Can you share the log file /home/chatratnco/.npm/_logs/2018-10-14T18_16_27_686Z-debug.log ?

neilherbertuk left a reply on Errors After Deploying Laravel/vue Project

Have you run npm install before run prod?

neilherbertuk left a reply on Display Redis Data In Laravel Blade

You'll want to use the data from redis as an array, forget wrapping it in a json_encode. Otherwise you'll need to JSON_decode it before you can use it in blade, which is an unneeded step.

Neil

neilherbertuk left a reply on Laravel Passport Authentication Keeps Redirecting To Login

How are you providing the token for your API endpoints? If you're API endpoints are within your routes/api.php file, it doesn't have the session middleware so it won't pickup the user from an already logged in session (and it should never have this as APIs are meant to be stateless). Your API endpoints will need to be provided the token within the request header.

https://laravel.com/docs/passport#passing-the-access-token

When calling routes that are protected by Passport, your application's API consumers should specify their access token as a Bearer token in the Authorization header of their request. For example, when using the Guzzle HTTP library:

$response = $client->request('GET', '/api/user', [
    'headers' => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer '.$accessToken,
    ],
]);

neilherbertuk left a reply on 404 Sorry, The Page You Are Looking For Could Not Be Found.

Hi sonford,

Check out Laracasts Posting Guidelines for best practices on formatting posts and providing the right information.

As Tray2 has said, what's in your routes file? A 404 is usually because a route has not been defined.

Neil

13 Oct
2 months ago

neilherbertuk left a reply on Doubt With Methods --resource

The part you've quoted is a docblock, it's just documentation. It helps your IDE to understand what to expect and let you know if it thinks you are trying to do something else. It won't stop it from running.

neilherbertuk left a reply on Doubt With Methods --resource

Your questions aren't very coherent. Your controller method will accept anything given to it, whether it's a string or an interger. $id is just a human readable name that we make connections with. You can name it whatever you like.

The $id parameter is just the name that will be given to the first argument passed to the method and is internal to that method. You can pass any variable into it, and you'll be able to call $id within that method to get the same data.

As for what other things your asking, I don't understand what you want to know.

Neil

neilherbertuk left a reply on Add Custom Fonts To Barryvdh/laravel-dompdf

Have you tried putting the fonts in the public/fonts folder? Give that ago and change your CSS so each font's src is pointing at /fonts/fontfile.tt

neilherbertuk left a reply on Is There Any Github App That Provide Smart Reply Like Features

This sort of thing uses AI to produce such results, it's unlikely you'll be able to roll your own or find a solution that does this.

neilherbertuk left a reply on Add Custom Fonts To Barryvdh/laravel-dompdf

I have no knowledge of barryvdh/laravel-dompdf, however, based on your code; you aren't telling it where to find the fonts. Your code is looking for the font relative to however it's being called. It has no idea that your fonts are in the /app/storage/fonts folder, even if that is accessible to it.

Neil

neilherbertuk left a reply on Redirect To Another Page After Download Xlsx File.

What you are trying to achieve isn't possible in the way you are doing it. The http session is being turned into a file download. When the file download has started the headers have already been sent. Anything further after that isn't really possible. You'll need to do the redirect client side. You'll probably want to use JavaScript to start the download and then get it to redirect.

Neil

neilherbertuk left a reply on Custom Validation Comparing Dates In Laravel

You'll want to take a look at the official docs on validation - https://laravel.com/docs/validation#rule-after-or-equal

after_or_equal:date
The field under validation must be a value after or equal to the given date. For more information, see the after rule.

Neil

neilherbertuk left a reply on Sequence Of Series

You are already on the website that'll help you. Go watch the Laravel from Scratch series. Then there is also a VueJS one.

Neil

12 Oct
2 months ago
11 Oct
2 months ago

neilherbertuk left a reply on Ordering System - Constant Database Update

Hi GEORGEMARTINS,

There are a few ways you can tackle this.

The simplest and most inelegant would be to put a meta refresh tag on your backend page.

Another would be to fetch data from the backend using JavaScript via an AJAX call every few seconds and replace the appropriate content on the page.

The most elegant would be to use JavaScript with websockets (Laravel Echo) which will update the page live.

What have you already got?

Neil

01 Jun
6 months ago

neilherbertuk left a reply on Multiple Image Upload With Drag And Drop Sorting

It's an old series but will still be relevant - here on Laracasts there is the Build Project Flyer with me series

  • https ://laracasts.com/series/build-project-flyer-with-me it covers a multiple image drag and drop uploader.

Neil

20 Apr
7 months ago

neilherbertuk left a reply on In_array() Expects Parameter 2 To Be Array, Object Given

As the error describes $check needs to be an array, but it's a collection.

Within your blade you should be able to change $check to $check->toArray()

17 Apr
7 months ago

neilherbertuk left a reply on Property [q] Does Not Exist

My first suggestion would be to die and dump $poll to see what you are getting. dd($poll);

Do you have multiple rows in your poll table? If so you are returning all rows using Poll::get(); and probably need to iterate (do a foreach) within the view as there won't be a column called q directly on $poll.

Neil

15 Apr
7 months ago

neilherbertuk left a reply on How To Setup Ajax For Route

You need to hard code the URL you want to post to.

neilherbertuk left a reply on How To Setup Ajax For Route

Is this embedded within a script tag within a blade template or is this within a .js file? If it's within blade check within your source code in the browser what the URL has been replaced with. If it's within a JS file the blade URL tag won't have been replaced.

You can check what is being called by using the network tab of your browsers developer tools (F12). You can also debug this kind of issue with the Laravel Debugbar

Neil

14 Apr
8 months ago

neilherbertuk left a reply on Only Allow Users With Role ID 1 And 2 Access OrganizationController.

Don't reinvent the wheel, there are plenty of packages out there that handle roles for you. My go to package is spatie/laravel-permission.

This package has some really good syntax and includes middleware which you can use in your controllers constructor

public function __construct()
{
    $this->middleware(['role:super-admin|other-role']);
}

Neil

neilherbertuk left a reply on The Way Laravel Vue SPA Using API To Access Logged In User Data

Though you could use oAuth2 with Laravel Password, personally I use JWT for Vuejs SPAs.

For the front-end side I use websanova/vue-auth

I use tymondesigns/jwt-auth for the back end.

This isn't quite how I do it but a good tutorial covering this is here - https://codeburst.io/api-authentication-in-laravel-vue-spa-using-jwt-auth-d8251b3632e0

Neil