newSequence

newSequence

Member Since 2 Years Ago

Experience Points 5,340
Experience Level 2

4,660 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 45
Lessons
Completed
Best Reply Awards 1
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.

22 Feb
1 month ago

newSequence left a reply on MethodNotAllowedHttpException In RouteCollection.php

If the item is being destroyed and you are attempting to then reload the page, is the error not occurring becuase you are attempting to load the page for a now invalid item id?

newSequence left a reply on Use Trait To Override AttributesToArray On Model

@ROERJO - I appreciate the suggestion, took a look and tried it and unfortunately it specifically deals with multiple traits sharing the same method names. Thank you though, was definitely worth a look.

21 Feb
1 month ago

newSequence started a new conversation Use Trait To Override AttributesToArray On Model

0

I am attempting to override the attributesToArray method on Model.php for use in a trait I am using on another model, lets call it sale.php. I am doing this to decrypt attributes when converting to json. Essentially using a version of the encryptabletraits class that is floating around.

use Illuminate\Support\Facades\Crypt; use Illuminate\Contracts\Encryption\DecryptException;

trait EncryptableTrait {

public function getAttribute($key) { $value = parent::getAttribute($key); if (in_array($key, $this->encryptable) && (!is_null($value))) { $value = Crypt::decrypt($value); }

return $value;

}

public function setAttribute($key, $value) { if (in_array($key, $this->encryptable)) { $value = Crypt::encrypt($value); }

return parent::setAttribute($key, $value);

}

public function attributesToArray() {

$attributes = parent::attributesToArray();

foreach($this->getEncryptable() as $key) {

    if(array_key_exists($key, $attributes)) {
        try {
            $attributes[$key] = Crypt::decrypt($attributes[$key]);
        }
        catch(DecryptException  $e)
        {
            continue;
        }

    }
}
return $attributes;

}

protected function getEncryptable() { return property_exists($this, 'encryptable') ? $this->encryptable : []; } } Then in the sale class I use it like so:

class Sale extends SaleBase { use EncryptableTrait;

//these are just examples protected $encryptable = [ 'credit_card', 'credit_card_pin' ]; //lots of other stuff here } The issue is that attributesToArray in the trait is never called the Model method is; but if I pull that function out of the trait and place it directly in the sale class, it works. The sale class inheritance is probably stacked 5 or 6 classes deep before getting to the base Model class.

attributesToArray is not defined anywhere in sale or indeed anywhere else except in the trait and the base Model class.

How do I get it to work while keeping it in the trait? I don't want to put the attributesToArray function in Sale becuase I want to reuse the trait in other classes.

The getAttribute and setAttribute methods work from the trait without issue.

28 Nov
4 months ago

newSequence left a reply on Parent With Children Tree In Blade

@CHARITABLEHUMANS - 'regular' php can be placed in a balde file without issue. just use the tags

newSequence left a reply on View Displays Success Message Twice

Are you sure you are not also displaying the success message in your layouts.app file?

26 Nov
4 months ago

newSequence left a reply on Get Senders TLS Certificate Info?

@D9705996 - Thank you, it does appear to be the case. I appreciate your help.

newSequence left a reply on Get Senders TLS Certificate Info?

Hi Snapey, you are right, the client is required to have a ssl cert for client auth. I agree that looking for a specific finger print is not optimal but it is unfortunately the requirement. The general consensus appears to be that I need to use something like fast cgi on nginx and then look at the fingerprint in the $_Server variable. Is that accurate?

newSequence left a reply on Get Senders TLS Certificate Info?

Thank you, but this appears to be code to validate a site's certificate as opposed to a tls request sent to my application. Unless I am reading it wrong.

newSequence left a reply on Get Senders TLS Certificate Info?

Yes, thank you. Conceptually similar to that but I want to know if there is a way to do this without editing the nginx server?

newSequence started a new conversation Get Senders TLS Certificate Info?

Is there a way to get the certificate fingerprint via the REQUEST object, or any other way? I need to test for a specific fingerprint before allowing data to be returned from a route.

08 Nov
2 years ago

newSequence left a reply on Eloquent Output Appears Hashed In Tinker Console

That was it, thank you shez1983, just needed to limit the results.

newSequence started a new conversation Eloquent Output Appears Hashed In Tinker Console

I have a model called cart, I call a get on it in Tinker and while it returns records, at a certain point the records appear hashed. The application has not issues reading them though. I am using a sqlite database. I have pasted a sample of the output below, begins with proper data objects and then towards the bottom it appears to hash everything. All the data is read accurately in my application though, even for the hashed records. I am using the term hashed because I don't have a better word. Any ideas why this is occurring?

App\Cart {#795 id: "248", sessionid: "94be102b71613d194d1de761bc5623f0", accountid: "44", productid: "29", orderid: "277", promotionid: null, price: "23000", tax: "1437.5", created_at: "2016-11-07 16:14:23", updated_at: "2016-11-07 16:16:06", year: "2016", month: "9", subscriptionlengthid: "2", subscriptionid: "5", }, App\Cart {#793 id: "249", sessionid: "1cfac37be091c0f66694801d73c8c071", accountid: null, productid: "1", orderid: "279", promotionid: null, price: "1500", tax: "200", created_at: "2016-11-07 18:01:28", updated_at: "2016-11-07 18:07:45", year: "2016", month: "10", subscriptionlengthid: null, subscriptionid: null, }, App\Cart {#791 …14}, App\Cart {#789 …14}, App\Cart {#787 …14}, App\Cart {#785 …14}, App\Cart {#783 …14}, App\Cart {#781 …14}, App\Cart {#779 …14}, App\Cart {#777 …14}, App\Cart {#775 …14}, App\Cart {#773 …14}, App\Cart {#771 …14}, App\Cart {#769 …14}, App\Cart {#767 …14}, App\Cart {#765 …14}, App\Cart {#763 …14}, App\Cart {#761 …14}, App\Cart {#759 …14}, App\Cart {#748 …14}, App\Cart {#1771 …14}, App\Cart {#1773 …14},