neilherbertuk

ICT Systems Development Engineer at Keele University

Experience

32,240

17 Best Reply Awards

  • Member Since 3 Years Ago
  • 273 Lessons Completed
  • 0 Favorites

1st June, 2018

neilherbertuk left a reply on Multiple Image Upload With Drag And Drop Sorting • 2 months ago

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

20th April, 2018

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

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()

17th April, 2018

neilherbertuk left a reply on Property [q] Does Not Exist • 4 months ago

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

15th April, 2018

neilherbertuk left a reply on How To Setup Ajax For Route • 4 months ago

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

neilherbertuk left a reply on How To Setup Ajax For Route • 4 months ago

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

14th April, 2018

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

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 • 4 months ago

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

13th April, 2018

neilherbertuk left a reply on How To Fix Vue Packages Version Mismatch Error • 4 months ago

I would assume that both entries you mention need to be the same. Change Vue to 2.5.16.

neilherbertuk left a reply on How To Fix Vue Packages Version Mismatch Error • 4 months ago

You can change the version number by editing your packages.json file and re-running npm install

11th April, 2018

neilherbertuk left a reply on E-signatures • 4 months ago

Hello Sign might be worth a look - https ://www.hellosign.com/api - they have a PHP SDK.

neilherbertuk left a reply on How To Show Only The Custom Fields For The Ticket Type That Is Associated With That Fields? • 4 months ago

From having replied to a previous post about this project, I get the feeling that you could make this a lot easier and simpler by using eloquent relationships instead of looking up all these relationships separately. It would also be a lot easier if you worked directly with the returned eloquent collection, you can use the select method to get only the columns you need.

Example, on your TicketType model you could add a many to many relation:

TicketType Model

```php public function questions() { return $this->belongsTo('App\Question', 'ticket_type_questions', 'question_id', 'ticket_type_id'); } ```

The above should work (not tested) and a call to $type->questions should return you the question for that ticket type.

Either give the type collection to your view or add the questions to your $selectedTypes array and then use the questions from that.

Neil

10th April, 2018

neilherbertuk left a reply on Installation • 4 months ago

You are probably better off following the install guide from the official docs - https://laravel.com/docs/installation

I tend to use the composer create-project method

  $ cd ~/Projects/
  $ composer create-project laravel/laravel ProjectName

This does most of what you need to get up and running. You will then need to change permissions on some folders as listed under the Configuration section of the docs.

Neil

neilherbertuk left a reply on Installation • 4 months ago

How did you install Laravel? What commands did you run? Have you cloned a project or done a fresh install?

To me it sounds like your missing your vendor folder and need to run:

  composer install

Neil

9th April, 2018

neilherbertuk left a reply on Show A Form Only If The Congress Has One Or More Ticket Types That Are Paid • 4 months ago

Ah so it's not still a collection

Try this instead

@if( array_sum(array_column($selectedTypes, 'price')) > 0 )

neilherbertuk left a reply on Show A Form Only If The Congress Has One Or More Ticket Types That Are Paid • 4 months ago

Hi @adamjhn,

This should be fairly straightforward to do. Assuming your $selectedTypes is still an eloquent collection; you could simply encase your billing section with an if statement to check that the Sum of all tickets is greater than zero.

@if( $selectedTypes->sum('price') > 0 )
  <h6>Billing Information</h6>
    <div>
        <label for="inputName" class="text-gray">Name</label>
        <input type="text" class="form-control" id="inputName">
    <div>
    <div>
        <label for="inputName" class="text-gray">Country</label>
        <select class="form-control custom-select" id="exampleFormControlSelect1">
            <option selected class="selected"></option>
        </select>
    </div>
    <button type="button" href="#step2" data-toggle="tab" role="tab">
        Go To Step 2
    </button>
@endif

Neil

neilherbertuk left a reply on Comparing Two Audio Files And Showing Result To The User • 4 months ago

PHP isn't exactly setup for audio files. What sort of comparisons are you wanting to do?

Neil

neilherbertuk left a reply on View Composer Not Working • 4 months ago

Have you registered your ComposerServiceProvider withing your config/app.php file?

8th April, 2018

neilherbertuk left a reply on How To Create Href Link In Laravel • 4 months ago

Not entirely sure why you would want to have this behaviour, it doesn't make a lot of sense. You've not been very clear on what and why you want this? You could create a form where the button submits some hidden value via a post request to the same page. You could then conditionally check for that value within your controller and return the other view instead. This way the end use has to press that button to see the other view.

neilherbertuk left a reply on How To Create Href Link In Laravel • 4 months ago

You will need some way for a user to request the registration page from the server so not sure what you're trying to achieve. If you aren't serving it from your server how will a user access it?

What exactly are you trying to achieve and why? Describe how you want the end user to interact with this for me?

neilherbertuk left a reply on How To Create Href Link In Laravel • 4 months ago

You need to ensure you have a route setup for your registration page and then you can make use of the URL generator

https://laravel.com/docs/urls

7th April, 2018

neilherbertuk left a reply on Putting .ENV Variables Into A Database Table? • 4 months ago

@ricardovigatti who was that aimed at? I think putting variables from your .env file into DB can be extremely useful, for example if you have a multi-tenancy app, being able to set the mail settings dynamically from DB would be a perfect use of this.

neilherbertuk left a reply on Laravel Middleware • 4 months ago

@devamit2018 everything you need to know on how to use that package can be found at the official GitHub repo for that package - https://github.com/crocodic-studio/crudbooster/blob/master/docs/en/index.md

neilherbertuk left a reply on Laravel Middleware • 4 months ago

Hi devamit2018,

It would be helpful if you could provide more detail to allow someone to be able to answer your question. 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.

What package are you using? Have you checked the docs to the package to see if they have included the blade templates for you with a namespace, or whether you have to publish them? I highly doubt that a package would include blade views for you to use without instructions on how to use them.

Based what you have asked, you would be looking at creating a Service Provider and within your boot method use

  $this->loadViewsFrom('file_path', 'namespace');

This would allow you to call

  view('namespace:bladeview');

Neil

neilherbertuk left a reply on Putting .ENV Variables Into A Database Table? • 4 months ago

There are quite a number of packages that actually do this. I'm working on an application at the moment where I had this same thought. It would be a lot easier for settings to be managed and stored in a database.

I think it's not something that is done "as standard" as it completely depends on the application and it's purpose. For a lot of applications it would probably be overkill to put something like this in. The application I'm working on may be open sourced at some point, so settings that can be configured in db would make it a lot easier for other people to manage.

Rather than using any of the packagers that do exist I've kept it very simple. I've created a Settings model, migration, seeder and service provider.

The migration only has a few columns, id, name, value and timestamps.

The seeder contains a simple array of default values for development purposes (before I create an install script).

The model contains 2 method, I've over written the create method and am serialising the value before it gets added to the db. I also have a static get method that accepts the key you want to get and returns the value unserialised. I've also added a cachable trait to from this package.

As for getting the settings, I've registered a SettingsServiceProvider that goes through replacing the config value with that from the db. This is pretty quick as it gets the settings from cache rather than db.

Hope this helps.

neilherbertuk left a reply on Where To Go ? Laravel Or .NET Core 2 • 4 months ago

My last reply was the short answer, this is the long.

Lots of companies prefer .net and Microsoft technologies because they have to pay for it through server licensing and IDEs. It gives a lot of companies a sense of security, because they pay money for something it must be enterprise ready and supportable.

The technology that's used makes no difference, PHP and .net are just as capable as each other. It's like trying to compare Burger King and McDonald's, it's just a matter of opinion and impossible to conclusively come up with a way to say which is better.

You have however, asked a PHP community this question. I don't think there would be a single person here who would say that PHP will be disappearing anytime soon. The company I work have have a mix of .net and PHP/Laravel applications and we are seeing more things starting to get developed with Laravel than .net due to the cost implications.

neilherbertuk left a reply on Where To Go ? Laravel Or .NET Core 2 • 4 months ago

No

6th April, 2018

neilherbertuk left a reply on What Is The Use Of Roles And Permissions In Applications? • 4 months ago

I suppose a permission would help with single responsibility. If you add a new feature, all you would have to do is add a new permission for that feature or task, rather than having to maintain a list of roles that need access to it.

What happens when you add a new role and need to give it access to certain features? You'll need to go through each method, modifying what roles are allowed.

Using permissions would mean you don't have to modify your code each time you want to make a role change as above.

neilherbertuk left a reply on What Is The User Of Roles And Permissions In Applications? • 4 months ago

Hi shivafeb17,

As with any design decision, it completely comes down to what suits you and your application. Using permissions would give you granular control over what a user can do. If you want different roles to be able to perform the same task you can assign a permission to the role and check for a permission instead of checking for multiple roles.

Again it depends on what level of control you need within your application.

Neil

2nd April, 2018

neilherbertuk left a reply on Updating Record From Vue.js To Laravel • 4 months ago

@afoysal you'll need to take a look at the places I've mentioned in my last post to pinpoint where your issue is.

Open your browsers developer tools (F12) and see if there are any error messages on the console tab after you've performed the Ajax call. I'd also check the stotage/logs/laravel.log file for errors.

Checking the two areas will tell you if you issue is in the front-end or backend.

Neil

neilherbertuk left a reply on Updating Record From Vue.js To Laravel • 4 months ago

Hi AFOYSAL,

What happens in your browsers debug console when you do this Ajax call? Also have you tried using the Laravel debugbar to see what's going on across the entire request cycle?

Are you getting any errors in the console? How about what's the response your getting from the server? Are there any errors in you log file?

Neil

28th March, 2018

neilherbertuk left a reply on Warning: Unknown: Failed To Open Stream: No Such File Or Directory In Unknown On Line 0 • 4 months ago

Hi BONHEUR_BERCOVE,

It would be helpful if you could provide more detail to allow someone to be able to answer your question. 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.

Neil

25th November, 2017

neilherbertuk left a reply on Laravel Conexión A Sqlserver 2008 • 8 months ago

DB_CONNECTION=sqlserver

Your entry within the database.php file must match the name of the connection you are trying to use.

22nd November, 2017

neilherbertuk left a reply on Unable To Upload File On Server : Failed To Open Stream: Is A Directory • 8 months ago

As I said in my reply, change your \ to / in your file paths.

If you file path is /var/www/project/folder/file.pdf, your script is trying to make that as a folder. Which will then fail to upload because you are trying to save it over something that already exists.

neilherbertuk left a reply on Unable To Upload File On Server : Failed To Open Stream: Is A Directory • 8 months ago

The directions of your slashes in file paths matter on Linux hosts. You are using a combination of both forward and back slashes. I'm going to guess your Dev environment is a Windows box? As it tends not matter on windows. Change your back slashes to forward slashes and see where that gets you.

Neil

20th November, 2017

neilherbertuk left a reply on ERR_TOO_MANY_REDIRECTS In My Laravel • 9 months ago

Hi amk,

It would be helpful if you could provide more detail to allow someone to be able to answer your question. 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.

The first place to start would be your servers error logs and your laravel.log file to see if there is anything obvious.

Neil

neilherbertuk left a reply on I Upgraded The Laravel Of My Lumen Project From 5.2 To 5.4 And My Route Is No More Working • 9 months ago

To upgrade Lumen, you need to follow the Laravel upgrade guides when changing between versions.

https://lumen.laravel.com/docs/5.4/upgrade

You will need to make sure you run through the upgrade to 5.3 and then 5.4

https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0 And https://laravel.com/docs/5.4/upgrade#upgrade-5.4.0

There are a lot of breaking changes between versions.. There are several changes to routing listed on these upgrade guides. I can't see this listed but the folder structure between 5.2 and 5.3 has changed, routes are now in the routes folder, under different files web.php and api.php

https://mattstauffer.com/blog/routing-changes-in-laravel-5-3/

Hopefully moving your routes into the appropriate file might help?

12th November, 2017

neilherbertuk left a reply on One App Or Auth To Rule Them All? • 9 months ago

Well having a centralised authentication system and your apps separate is better all round; firstly your apps are more secure from a point of view that they don't store any passwords! Secondly every application is silo'd so if one gets compromised no other system or datasets are at risk.

If you go for a single "mega-app", if someone gets in, everything is likely to be at risk. As you've said, you would have some complex roles and permissions management.

I'm guessing from your link that you also work at a university in the UK? It might be worth looking at the JISC UK Federation as you would be able to allow users from other institutions to login to your application using their institutes SAML service. https://www.ukfederation.org.uk

neilherbertuk left a reply on One App Or Auth To Rule Them All? • 9 months ago

Hi ohffs,

This is where you want to take a look at SAML2 (Security Assertion Markup Language) or SSO (Single Sign On). There are plenty of solutions out there that can do this for you, and even integrate with LDAP or active directory (AD).

Using SAML, you would setup an Identify Provider (IdP) which would deal with all of your authentication. Each application would be a Service Provider (SP). Your IdP would simply replace the authentication mechanism, the SP would still have to track user accounts. Each SP would still be able to deal with its own roles and permissions locally. Imagine having a user record but no password field on the SP. The SP would have its own logic for what to do when a user it hasn't seen before gets logged in. Such as creating a user record for it but having to have an admin assign roles before they can do anything, or you could have your roles and permissions assigned through your organisation's AD or LDAP service and have them managed centrally.

There are many pre-existing solutions out there which are open source and free, so no need to reinvent the wheel.

A widely used option would be Shibboleth - https://www.shibboleth.net - this is widely used within the education sector. I'm pretty sure this is not written in php.

SimpleSAMLphp may be a good option - https://simplesamlphp.org

There are several other packages out there on packagist, however these are not supported by large organisations so I wouldn't be able to vouch for their integrity. - https://packagist.org/?q=saml&p=0

I am using a combination of 2 packages that are available on packagist. However, I have forked and further developed one that I am using as an IdP, I'm also only using the IdP as a local development replacement for my organisation's SSO solution.

Hope this helps, happy to answer any further questions you might have.

Neil

3rd October, 2017

neilherbertuk left a reply on Small View Problem With Laravel 5.5 • 10 months ago

Your we route is /company, not /company/index

29th September, 2017

neilherbertuk left a reply on Add Video • 10 months ago

@The_blues please take a look at the posting guidelines I mentioned in my first reply. It's extremely hard to follow code that isn't formatted correctly. Please use markdown to format it.

neilherbertuk left a reply on Add Video • 10 months ago

As you've not answered my questions I can only guess and assume what you are trying to do.

I'm assuming you need to collect data from an end-user. You can do this with a html form and access the data submitted from the request which is detailed here on the Official Laravel Docs https://laravel.com/docs/5.5/requests#retrieving-input

Assuming you have an eloquent model, you should checkout this page https://laravel.com/docs/5.5/eloquent#inserting-and-updating-models which covers inserting and updating database entries.

Neil

neilherbertuk left a reply on Add Video • 10 months ago

Hi The_Blues,

It would be helpful if you could provide more detail to allow someone to be able to answer your question. 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 try to explain what you are trying to achieve in more than 3 words. Please give us context to what you are trying to do. Please also provide how far you've gotten with code examples.

When providing code please use the markdown to help display it properly, this it done be surrounding code with `````````.

Neil

28th September, 2017

neilherbertuk left a reply on My Client Ip Address Got Block By Server When They Access My Web App! Help • 10 months ago

Hi Larafam,

It would be helpful if you could provide more detail to allow someone to be able to answer your question. 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.

What you've asked isn't very clear. Some detail about your setup would be useful, such as are you on your own server that you control? Are you on shared hosting? Are protocol are you using, http or Https? If you are using TLS/SSL have you checked that you certs are find and that the issuer hasn't been blocked? How do you know the client is being blocked, what behaviour are they seeing? Are they getting timeouts? Can the client access your server by its IP address? Can they ping your server by domain or ip? Is your client located in a region that has government firewalls such as China? What have you already tried to find the problem?

Neil

27th September, 2017

neilherbertuk left a reply on Using "Form" Facade In My Own Package • 10 months ago

Hi Thomasbird

The Forms facade was removed from Laravel a whole ago and has been picked up by the Laravel Collective. They've not updated it for 5.5 yet but you can find the form facade available as a package from them here - https://laravelcollective.com/docs/master/html

Neil

25th September, 2017

neilherbertuk left a reply on Creating "Microsoft Like" Sign In Experience • 10 months ago

You need to implement a federated login or a SAML Identity Provider. Check out SimpleSAMLPHP. There are a few packages floating about that can also help.

SAML is designed to do exactly this and allows alot of enterprises to allow logins to multiple applications using a Single Sign On. A single portal is responsible for authentication and each application refer to it for authentication and session management.

Hope this is a nudge in the right direction.

Neil

24th September, 2017

neilherbertuk left a reply on Slow Request Times (>80ms) Local • 10 months ago

Try using https://github.com/barryvdh/laravel-debugbar as it can show you the total time it's taken for your app to load and where time is being spent.

Neil

23rd September, 2017

neilherbertuk left a reply on A Website For Getting A Template Database • 10 months ago

You are already on the best site to help you with that. Laracasts has a ton of videos which will teach you this. There are many video series that walk you through making a project from start to finish and will give you plenty of opportunities to learn about databases and database relations.

Neil

neilherbertuk left a reply on A Website For Getting A Template Database • 10 months ago

Hi nasr1,

Unfortunately, not that I am aware of. Databases are unique to the needs of your application, in the majority of cases, one size does not fit all. You've also not provided information to what sort of thing your even looking for or what you are trying to achieve, so, I highly doubt anyone will be able to help.

Can you tell me what your application is and why you want to database reuse? Obviously, if you've made a similar site before, you can take your migrations over to your new codebase.

Neil

Edit Your Profile
Update

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