D9705996

D9705996

Member Since 3 Years Ago

Glasgow

Software Developer at Sabio Ltd

Experience Points 292,670
Experience Level 50

0 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 1250
Lessons
Completed
Best Reply Awards 266
Best Reply
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.

13 Mar
2 months ago

D9705996 left a reply on Laravel Nova, No Hint Path Defined For [menu]

Not sure if will help but theres a github issue that sounds similar that has been solved

https://github.com/laravel/framework/issues/325

Might give you some pointers

D9705996 left a reply on Eloquent Log

You could use a custom monolog handler as described in this in depth tutorial

https://medium.com/binarcode/laravel-5-6-custom-monolog-channel-to-store-logs-in-mariadb-23da52f537e7

12 Mar
2 months ago

D9705996 left a reply on Real World Deploy (like Ubuntu) Recommend Folders Premission

@SOS99 - I change the owner to root so only the root user has write access as your application code should not be able to be changed by the user running the web server. I choose root as I have this account heavily locked down and only accessible via sudo so all commands are logged.

Thd larzvel documentation gives good high level setup requirements but would impractical or even impossible to document every possible setup and is assumed that you have sufficient webserver admin skills to be able to do this. There is also the option of laravel forge.

If you think the docs need further details you could always create a pull request on thd github repository

https://github.com/laravel/docs

D9705996 left a reply on Eloquent Log

Its not clear from your question exactly what you need but if you are looking to log the eloquent queries your application is running, possibly for debugging you should look at telescope

https://laravel.com/docs/5.8/telescope#query-watcher

09 Mar
2 months ago

D9705996 left a reply on Real World Deploy (like Ubuntu) Recommend Folders Premission

The equired permissions are covered in the documentation.

https://laravel.com/docs/5.8/installation#configuration

I would setup the owner of the files/directories as root and your webserver as the group and set file permissions to 0640 and directories as 0750

E.g. from your project root

chown root.apache * -R 
find -type d -exec chmod 750 {} \;
find -type f -exdc chmod 640 {} \;

This will setup the majority of thd permission but then for the directories that need webserver write like storage

chmod 660 storage -R
08 Mar
2 months ago

D9705996 left a reply on Authentication With Gitlab Api Using Laravel Socialite

Do you see anything useful in the logs from gitlab? (Not sure if you will be able to if your using hosted gitlab)

If you spin up your own gitlab instance does it work or hell troubleshoot. Fyi gitlab install is really easy

https://about.gitlab.com/install/#centos-7

D9705996 left a reply on How To Set Login FORM Alert Message

@BEKASKAKI - Awesome. Glad you got your issue sorted. Could you please mark the discussion as solved

D9705996 left a reply on Connection Could Not Be Established With Host Mailtrap.io

Fro your server can you connect to port 2525 on mailtrap?

telnet mailtrap.io w525

If you get an error then your issues network related

https://stackoverflow.com/questions/45409221/sending-mail-to-mailtrap-io

D9705996 left a reply on Payments With Stripe/paypal

@MUSA11971 - although their is a warning you can still use for one off pzyments

D9705996 left a reply on What Graps Package Is Good For Laravel And Vuejs ?

@PRINCEOO7 - Just be aware if you are using for commercial use you need a licence for highcharts

D9705996 left a reply on How Do I Apply Date('H:i:s', $this_array)??

You need to ensure you are passing the data from your backend to you frontend in the format chart.js expects. Have a tinker with console.log in you front end to see what's going wrong

D9705996 left a reply on What Graps Package Is Good For Laravel And Vuejs ?

Have a look at this package that allows many different chart providers, like highcharts

https://laravel-news.com/laravel-charts

Depending on your use case you might want to use

https://github.com/highcharts/highcharts-vue

You might be able to tell I'm a highcharts fanboy

D9705996 left a reply on Payments With Stripe/paypal

You should use cashier with the braintree driver as it supports PayPal. Stripe & cashier doesn't support paypal

https://laravel.com/docs/5.8/braintree

D9705996 left a reply on Retrieve A Polymorphic Relationship With Vue.js

You should just be able to use your relationship function name with with function

->latest()->with(['commentable'])->...

D9705996 left a reply on How Do I Apply Date('H:i:s', $this_array)??

You should be able to use eloquent casting on your model to set the format to what you want

protected $casts = [
    'time' => 'datetime:H:i:s',
];

https://laravel.com/docs/5.8/eloquent-mutators#array-and-json-casting

D9705996 left a reply on Custom Password Reset Api In Laravel 5.7

Any reason you are not using the out of the box password reset functionality?

https://laravel.com/docs/5.8/passwords

D9705996 left a reply on Securely Handling Client_secret Passport

Have a look at this blog for a general idea on securing the passport secrets

http://esbenp.github.io/2017/03/19/modern-rest-api-laravel-part-4/

What I would do is add a middleware that injects your secrets into the request so they are never stored client side.

D9705996 left a reply on How To Set Login FORM Alert Message

You should validate your request as per the documentation to include an error if the user is inactive.

https://laravel.com/docs/5.8/validation

You might want to use a middleware to respond with errors if the user isnt active

D9705996 left a reply on Observer `updating` Even If There Is No Change

You should be able to use isDirty() in your event

D9705996 left a reply on How To Close Connection In Response Header?

Have you tried taking all you code away to rule out anything weird and just trying

return response()
  ->json([])
  ->header('Connection', 'close');

Do you see the correct response headers?

D9705996 left a reply on How To Use Open Close Principle Of SOLID Principles?

I would highly recommend this laracasts series as the 5 core principles are all linked

https://laracasts.com/series/solid-principles-in-php

You are 100% along the right lines that adhering to an interface allows you to leverage polymorphism and binding the interfaces to concrete classes in the container gives you the flexibility you need.

Just remember the SOLID principles are not hard and fast rules just rules... you can break them!!!

D9705996 left a reply on Anyone Know How .$ctr. Work In Javascript?

$ctr looks like a php variable that interpolation into your javascript from your views. Javascript variables dont start with $

D9705996 left a reply on Artisan Serve Running Wrong Env

You can try setting the environment on the command line

export APP_ENV=testing; php artisan serve

D9705996 left a reply on How To Encrypt A Guid In 80 Characters

You are not going to be able to encrypt a guid in 60 characters. Why do you need this functionality? Why dont you look at how laravel does something similar with signed routes

https://laravel-news.com/signed-routes

D9705996 left a reply on Any Resources For How I Can Decouple Laravel Spark From My App?

@TONSOFLAZ - If you have a good test suite then it should nt be too painful to switch to something like cashier

https://laravel.com/docs/5.8/billing

It might be worth reacing out to Taylor with details of your issue as he might be able to point you in the right direction so you can keep using spark

D9705996 left a reply on Factory Default State

If you want a factory to be a default then just set the attributes in the main factory. You can then override then with your custom state factories

https://laravel.com/docs/5.8/database-testing#factory-states

D9705996 left a reply on Any Resources For How I Can Decouple Laravel Spark From My App?

Decoupling spark probably isnt easy given the FAQ says it's not designed to integrate with existing apps

https://spark.laravel.com/docs/8.0/faq#existing

Not sure if you could hook into the event/middleware system to acheive what you need

https://spark.laravel.com/docs/8.0/billing#checking-subscription-status-via-middleware

I'm not brilliant with spark so take my advice with a huge pinch of salt and there might be a better/easier option

D9705996 left a reply on How Can I Solve "Connection Could Not Be Established With Host Smtp.gmail.com"?

@MUZAMMILRAFAY - Your ability fix this will depend on where your hosting your application and what access you have to configure php.

Have a look at the possible solutions at

https://stackoverflow.com/questions/33401630/proc-open-has-been-disabled-for-security-reasons-php-error

02 Mar
2 months ago

D9705996 left a reply on Inserting Two Arrays Into A Pivot Table

Have a look at Additional Columns in Pivot Tables in

https://laraveldaily.com/pivot-tables-and-many-to-many-relationships/

You basically need to use attach instead of sync. You might need to do this in a loop

D9705996 left a reply on Standard Database Data My App Needs

You could look at using another document type to store your seed data and use this for this sedding. E.g. excel

You might like https://github.com/Maatwebsite/Laravel-Excel

D9705996 left a reply on Route Orders Causing Confliction?

Your white screen is usually due to a fairly fundamental issue and will have details in php_errors log file but i suspect memory exhaustion based on your problem.

I think your /admin route was picking up requests for the more specific /admin/products as the route to retrieve a single admin resource e.g. /admin/{admin}

TBH I would look at route groups and add an admin prefix and really try and stick to the restful actions as it will really simplify your routing. The docs are comprehensive

https://laravel.com/docs/5.8/routing

D9705996 left a reply on Fabricjs Does Not With Laravel

You haven't put your javascript inside script tags in your example

D9705996 left a reply on Datetime::setTimestamp() Expects Parameter 1 To Be Int, Float Given

Laravel 5.8 adds support for carbon 2 which might be related

https://laravel-news.com/carbon-2-laravel

The settimestamp does expect an integer from the docs so you should review your code and one possible option would be to cast the floats to integers (int) $float

http://php.net/manual/en/datetime.settimestamp.php

D9705996 left a reply on Open Source App For Loyalty

Sounds like you are looking for a CRM. Maybe something like

https://laraadmin.com/

D9705996 left a reply on Model's Events 'updating' And 'updated' Not Fired ('saved' Instead)

Is the data you are passing in the request actually changing the model? If not then update/updating won't fire IIRC

D9705996 left a reply on Npm ERR! A Complete Log Of This Run Can Be Found In:

Are there any other errors in the output as the above is the generic failure message. You might need to look through the log file mentioned but be aware it can be pretty verbose

19 Feb
3 months ago

D9705996 left a reply on Remove Empty Array From Laravel Resource Collection

@SARMADINDHAR - You can try chaining a flatten() (you might need to play with the ordering to get the desired output), I'm also not sure if you need the trailing all()

$notifications = collect($notifications)->filter()->flatten()->all();

https://laravel.com/docs/5.7/collections#method-flatten

18 Feb
3 months ago

D9705996 left a reply on Mail Test Not Passing

You can start tinker as per docs

https://laravel.com/docs/5.7/artisan#tinker

You then type your code but you might need to put in full namespace for your classes e.g.

event(new App\Events\Registered(create('App\User')));

D9705996 left a reply on Remove Empty Array From Laravel Resource Collection

With filter you dont need a function if you want rid of falsely values like []

$collection = collect([1, 2, 3, null, false, '', 0, []]);

$collection->filter()->all();

// [1, 2, 3]

Your controller code looks odd as your performing two assignments to $notifications overwriting the first one

$notifications=Auth::user()->notifications()->orderBy('id','DESC')->get();
$notifications=TechnicianNotification::collection($notifications)->resolve();
return $notification;

D9705996 left a reply on Mail Test Not Passing

Have you tried firing your event through php artisan tinker? Does this send your email? If so then theres an issue with the test otherwise your event is the problem

D9705996 left a reply on Multiple Laravel Echo Instances With Different Pusher App Keys

You could duplicate the alpha_pusher setup in your config file for the beta_pusher and then manually set the BROADCAST_DRIVER in you code to override the default alpha_pusher setting

config(['BROADCAST_DRIVER'] => 'beta_pusher]);

D9705996 left a reply on A Simpler Way To Get All Attributes From A Model Including Timestamp

I think you can use $model->attributesToArray() which should give you al, attributes including dates if I havd read the api docs correctly

https://github.com/laravel/framework/blob/5.7/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L85

03 Feb
3 months ago

D9705996 left a reply on How To Show Message After Verify Email ?

You can set the route the user is redirected to with this property.

protected $redirectTo = '/dashboard';

So you could setup your thanks view.

https://laravel.com/docs/5.7/verification#after-verifying-emails

D9705996 left a reply on How To Remove Html Tags From String In Accessor

Are you using {!! ... !!} tags in your blade templates as the standard {{ ... }} tags are automatically passed through htmlspecialchars?

02 Feb
3 months ago

D9705996 left a reply on Accessor When Some Attributes Can Be Null

@LEONIDAS - You could use a regex to strip any trailing characters

D9705996 left a reply on Use Route Parameter As A Model Name?

@SNAPEY - I've not tested but I think form requests are method agnostic. Worst case you could abstract the same logic to a controller

D9705996 left a reply on Accessor When Some Attributes Can Be Null

@LEONIDAS - Please mark discussion as solved if you or have fixed your isdue