neilherbertuk

ICT Systems Development Engineer at Keele University

Experience

33,960

19 Best Reply Awards

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

18th October, 2018

neilherbertuk left a reply on In Regards To Laravel Ffmpeg • 14 hours ago

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

14th October, 2018

neilherbertuk left a reply on Errors After Deploying Laravel/vue Project • 4 days ago

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

Have you run npm install before run prod?

neilherbertuk left a reply on Display Redis Data In Laravel Blade • 4 days ago

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

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. • 4 days ago

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

13th October, 2018

neilherbertuk left a reply on Doubt With Methods --resource • 5 days ago

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 • 5 days ago

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 • 5 days ago

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 • 5 days ago

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 • 5 days ago

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. • 5 days ago

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 • 5 days ago

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 • 5 days ago

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

12th October, 2018

neilherbertuk left a reply on I Want To Send My Laravel Store Orders To Amazon For Shipping (FBA) Service. • 6 days ago

I have no knowledge of this but a simple, 2 second Google reveales this package https://packagist.org/packages/sonnenglas/laravel5-amazon-mws which has functionality to create fullfillment orders.

Neil

11th October, 2018

neilherbertuk left a reply on Ordering System - Constant Database Update • 1 week ago

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

1st June, 2018

neilherbertuk left a reply on Multiple Image Upload With Drag And Drop Sorting • 4 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 • 5 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 • 6 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 • 6 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 • 6 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. • 6 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 • 6 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 • 6 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 • 6 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 • 6 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? • 6 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 • 6 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 • 6 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 • 6 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 • 6 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 • 6 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 • 6 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 • 6 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 • 6 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 • 6 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? • 6 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 • 6 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 • 6 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? • 6 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 • 6 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 • 6 months ago

No

6th April, 2018

neilherbertuk left a reply on What Is The Use Of Roles And Permissions In Applications? • 6 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? • 6 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 • 6 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 • 6 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 • 6 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 • 10 months ago

DB_CONNECTION=sqlserver

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

Edit Your Profile
Update

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