polarcubs

polarcubs

Member Since 4 Years Ago

Experience Points
105,520
Total
Experience

4,480 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
906
Lessons
Completed
Best Reply Awards
5
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 22
105,520 XP
Jan
20
1 year ago
Activity icon

Replied to How To Use Microservices In A Webshop?

Try this package. It looks pretty good. Yea I kinda hated that almost every company I interviewed with now uses microservices and I end up having to use some tricks to get Eloquent relationships right again.

https://github.com/LUSHDigital/microservice-remote-models

Oct
20
1 year ago
Activity icon

Started a new conversation Given Table Name, Get The Associated Model

Is there an easy way where given the string 'users' (or any other string), returns the Model associated with that table name?

Something like model_from_table_name('products') and it returns App\Product

Oct
13
2 years ago
Activity icon

Replied to What's The Use Of Route::domain Or Route::group(['domain' => 'xyz.com'])

Yep read that before I post here. It wasn't clear enough to me. I need more practical examples

Activity icon

Started a new conversation What's The Use Of Route::domain Or Route::group(['domain' => 'xyz.com'])

What's the use of Route::domain or Route::group(['domain' => 'xyz.com'])?

A code base I inherited uses it in their routes file all over the place.

The official documentation doesn't explain much.

Oct
08
2 years ago
Activity icon

Replied to Joining 2 Tables With BelongsToMany Where 1 Table Field Need Some Str_replace

Sadly I'm not allowed to alter the table to add or any fields. nor do str_replace on \40 to @

What is \27 I'm not sure too.

Activity icon

Started a new conversation Joining 2 Tables With BelongsToMany Where 1 Table Field Need Some Str_replace

Table 1 username field is like 'hooray#welcome.com'

Table 2 username field is like '[email protected]'

using belongs to many or table joins give me problem because obviously hooray\40welcome.com & [email protected] don't matches. How do I do str_replace on an sql join/belongs To many?

Also anyway to force postgreSQL to do implicit comparison so that '5' = 5 works instead of throwing errors?

for belongsTo or hasOne, I can avoid mitigating the issue with setBindings(). But not this.

Oct
07
2 years ago
Activity icon

Replied to Eloquent Relationship And GetPrimaryKeyAttribute Conflict.

Hey guys this is the cleanest solution I derived myself so far! I will pick this as the answer unless someone find a better way.

return $this->belongsTo(User::class, 'username', 'username')->setBindings(['right-format-username'])

or 

return $this->HasOne(Phone::class, 'username', 'username')->setBindings(['right-format-username'])

However I can't get it to work for belongsToMany or morphToMany yet. $user->items() work fine.

But $item->users() do not work as it attempts to join the tables (users table and the newer table) and the emails format don't match.

Oct
04
2 years ago
Activity icon

Started a new conversation What Exactly Does SetRelation Do? Examples?

What exactly does setRelation do? What is it helpful for? Real world Examples?

Oct
03
2 years ago
Activity icon

Replied to Eloquent Relationship And GetPrimaryKeyAttribute Conflict.

I wouldn't call him a lost cause, he has really good academic credentials (Yup, he came from the academia)

I would just say he likes playing it safe and I hope he never visits here!

Activity icon

Replied to Eloquent Relationship And GetPrimaryKeyAttribute Conflict.

By why only numbers as username I mean you 36864 (Your laracasts username)

I thought of another approach but hmm is this the best possible?

but belongsToMany pivot table with extra attributes I'm not sure how to "hack" it though

public function phone() {

    // for $user->phone()->get() returns collection array but I think that's laravel

   // behaviour too. Does not returns belongsTo object. Returns EloquentBuilder instead
    return Phone::where('username', 'right-format-username');

}

public function getPhoneAttribute() {

// for $user->phone
    return Phone::where('username', 'right'format-username')->first();
}


Activity icon

Replied to Eloquent Relationship And GetPrimaryKeyAttribute Conflict.

@36864. I'm a month into the job now, did not succeed in convincing. My best bet for now I guess would be

function phone() {
    return Phone::where('username', 'right-format-string');
}

// do this bla... :(

$phone = $user->phone()->first();

I'm not even allowed do a local dump of the database & it's table schema actually. It is a US medical related company that has to comply with HIPPA compliance in regards to personal health information (PHI). I don't understand it well enough yet despite a short online orientation course they made me to attend but I guess that means I cannot have a local copy of the database (I'm a remote developer for them, not sure about the onsite guys. The database is really huge to me anyway so downloading it for local use likely won't work for me too. Manager said no too).

There is a staging posgresql database, probably 1 month older than the production 1. But also used by all the other softwares and websites development teams of the company so it felt risky for me to change anything too.

what's special about utf8mb4_general_ci and why only numbers as username? Just curious out of the blue.

Activity icon

Replied to Eloquent Relationship And GetPrimaryKeyAttribute Conflict.

@sutherland I'm not allowed by my manager to add an id field to existing tables either. If there is no way to hack around it, how should I file an issue with laravel/framework to use $this->attributes[fieldName] or an extra argument to let us specify the value to use. ([email protected] or me\40hooray.com)

Tried diving into the framework's hasOne() code and it's beyond me.

Activity icon

Replied to Eloquent Relationship And GetPrimaryKeyAttribute Conflict.

Hi @36864 and @Parasoul I updated my post to explain more in details

Basically for the newer tables, username is stored as proper emails e.g. ([email protected])

However in the older tables username is stored as 'me\40hooray.com' or 'me\\40hooray.com (more slashes for some tables even and nobody can tell me the reason other than 'legacy' from old days) Yea that's how it is. I can't normalise all the tables to just use @ since there are other projects (the android, iPhone, desktop apps, other websites) that also retrieve from the same database that are not under me.

If I don't mutate, I can't do relationships with newer models. If I mutate I can't do relationships with older models/tables.

Laravel should have used $this->attributes['username'] internally.

My best try so far is to return Model::where('username', ...) where I do str_replace on @ or \40 depending on the table stores username in the old or new way. But that isn't that ideal. I can't do $user->phone, when I call $user->phone()->get(), I get a Eloquent Collection array

I have asked my manager since day 1 and he does not allow me to modify existing tables to add new fields. So adding an id field is already out of the question. I guess he wanted to play things safe. Seeing as some tables are really huge in the number of rows.

Activity icon

Started a new conversation Eloquent Relationship And GetPrimaryKeyAttribute Conflict.

Hi,

Currently in the legacly project I inherited username is the primary key

The username need some formatting when it is shown to user so naturally I did this

public function getUsernameAttribute() {

    return 'formatted-username-here'
}

However at the same time I am also writing Eloquent relationship methods

public function phone() {
    return $this->hasOne(Phone::class, 'username');

}

Everything looks good except that when I run $user->phone, I get null everytime

So I tried the following

$user->phone()->toSql(); // Looks good


// returns an array with the formatted string instead of the raw one!
$user->phone()->getBindings(); 

How do I fix this? Don't suggest me to remove getUsernameAttribute() and write a getFormattedUsernameAttribute() instead. I have my reasons not to. Some legacy related reasons. The newer tables had username stored in the "formatted way" (e.g. [email protected]) and the old tables had username stored in the "raw" way (me\40hurray.com)

Sep
30
2 years ago
Activity icon

Replied to Redis Sentinel In Laravel, NodeSetName, RedisConfigName, Back Off Strategy & Masters.etc Config?

@cyrossignol Ah 1 more. If I use your package, do I need to comment out Laravel own Redis Service Provider and Facade?

For local development, I don't use sentinel. Only for staging and production use sentinel.

Sep
29
2 years ago
Activity icon

Started a new conversation How Do I Override Where() Method For A Particular Model?

How do I override where() method for a particular model?

Sep
28
2 years ago
Activity icon

Started a new conversation Unable To Use $this->authorize In Controller Constructor

Unable to use $this->authorize in controller constructor but able to use it in non constructor controller methods it seems. I'm on Laravel 5.5.

Any help on this?

Sep
26
2 years ago
Activity icon

Started a new conversation Redis::get Returns FALSE Or Null When Key Not Found?

Some place tell me it returns FALSE when a key is not found, some place tells me it returns null. Which is correct?

I'm on Laravel 5.2 but fine with answers for later versions too.

Sep
16
2 years ago
Activity icon

Replied to How To Validate JSON Input Using Requests?

Hi some questions. Do I still need to add this JsonApiMiddleware in Laravel 5.5?

Should I add an array cast @fureszpeter or not as suggested by @zainescu ?

Sep
15
2 years ago
Activity icon

Replied to Is It Possible To Define Eloquent Relations Where Table A Is In A Different Schema From Table B?

I did that already, but can I join them given they are in different Schemas?

Activity icon

Started a new conversation Is It Possible To Define Eloquent Relations Where Table A Is In A Different Schema From Table B?

Is it possible to define Eloquent relations where table A is in a different Schema from table B?

Using PostgreSQL. Same database but table A is in a different Schema from table B. I'm new to postgreSQL too. I see Schema as a sub database.

Sep
14
2 years ago
Activity icon

Started a new conversation InvalidArgumentException With Message 'Trailing Data' For A Date Field

Hi for some reason when I try to access an existing database table created_at field I keep getting a InvalidArgumentException with message 'Trailing data' error.

The value of created_at is something like this:

2015-03-12 09:25:42.383103

How do I fix it?

In my models I had $dates array defined. in $casts I defined created_at as a datetime field. I commented both out but I still get the same error. It's a postgres database. I don't have the rights to modify the database table only the code.

I searched Github and it appear a few people has filed this issue with Postgres & laravel, however @TaylorOtwell closed each of them. Does anybody know of a fix I can apply?

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

Activity icon

Started a new conversation Eloquent Relationships When The Joining Field Value Is A Little Different

Well inherited a codebase. It uses email as PK for the users table. However the @ symbol is stored as \40 and some other character for something else

There are other tables, but in the other tables, when referring to the user, it is the correct email unicode style say [email protected]

How do I define eloquent relationship and join them? I can't modify any of the tables as the iOS app, Andriod App and other stuffs worked on by other developers all uses that.

so [email protected] <--> me\40hooray.com for example how to write my relationship methods and such?

public function user() {
    // first I need to do a string replace on users table \40 to @ symbol first!
    $this->belongsTo(User::class);
}

Also for when I retireve $user->email I want it [email protected] I think I read somewhere getEmailAttribute

Sep
13
2 years ago
Activity icon

Started a new conversation Attribute Casting Question When Value In Db Is Null

in my $casts, I set a field to => 'string', however for some rows it had null values. When I retrieve it, will be be null or an empty string? same for those I had cast to integer.etc

$casts = [

    'name' => 'string' // some rows had it null
    'quantity' => 'integer' // some rows had it null
    'timestamp' => 'datetime' // Another Q: What's the point when there is $dates already?

];
Sep
12
2 years ago
Activity icon

Replied to Redis Sentinel In Laravel, NodeSetName, RedisConfigName, Back Off Strategy & Masters.etc Config?

Ah thanks locally work now, though redis-sentinel not yet. Will post here again when I get to test on the staging and production environment.

Activity icon

Replied to Redis Sentinel In Laravel, NodeSetName, RedisConfigName, Back Off Strategy & Masters.etc Config?

Ah! okay

It seems the code base config is more troublesome than this.

different REDIS_HOST, REDIS_PORT, REDIS_SENTINEL_SERVICE, database values are grabbed dynamically from somewhere else depending on if it's production, staging or local that I have no access to in database.php rather than from the local .env file

for example to define the multiplie sentinels it has

array_map returning an array of array inside.

[
 [host, port], [host, port], [host, port]...
]

So I got to think of how to strip out the outer array as I pass in the config. is there a way to return multiple arrays from a function? I currently do it this way at the end

// $host is an array
foreach($hosts as $host) {
    $db_settings['redis-sentinel']['blablaba'][] = $host;
    $db_settings['redis-sentinel']['yadayada'][] = $host;
}

return $database_settings;

So I'm going to look at what is prescribed in your database.php file section to figure things out

Your docs say the following are handled

Redis::get('key');
Cache::get('key');
Session::get('key');
Queue::push(new Job());

However in the codebase more methods such as set, expire, del are used. Does it automatically map over as well?

Do I need a spacing between hosts? sentinel1.example.com, sentinel2.example.com?

Also saw a couple of "If the application contains a specific connection in the 'redis-sentinel' database configuration for the queue/cache.etc, replace 'connection' => 'default' with its name." what do you mean?

Lastly, should I remove 'redis' since I defined 'redis-sentinel in database.php?

I got Driver [redis-sentinel] is not supported error as of this moment.

Sep
11
2 years ago
Activity icon

Replied to Redis Sentinel In Laravel, NodeSetName, RedisConfigName, Back Off Strategy & Masters.etc Config?

Sure I will just switch to yours then. I just upgraded to 5.3. I'm not familiar with redis beyond using it as a queue and simple cache. so a guide as for how to map each of the option to yours would be great. I am going to look at your docs now.

Will you continue your package despite sentinel support being added since 5.4?

And if I go with the options for 5.4, how should the parameters be specified in the url (client connection object?)

Oh and what's client side sharding? Thanks!

Sep
09
2 years ago
Activity icon

Started a new conversation Redis Sentinel In Laravel, NodeSetName, RedisConfigName, Back Off Strategy & Masters.etc Config?

Hi guys,

Recently I inherited a Laravel 5.2 codebase. It utilises Redis Sentinel with itryit/laravel-ps-redis (https://github.com/iTryIt/laravel-PSRedis) which isn't supported in Laravel back then. However a quick google search showed that Redis Sentinel support is added this year to Laravel. Probably for Laravel 5.4

https://github.com/laravel/framework/pull/18850

Now I'm in the process of upgrading it to 5.3 and hopefully 5.4/5.5

I looked at the config settings for itryit/laravel-ps-redis and Laravel 5.4 and couldn't exactly map out which value go where. Any help would be appreciated. Especially I don't see nodeSetName, cluster (I assume this fall under clusters->default), Redis Config Name, back off strategy, masters.etc stuffs in the Laravel 5.4 version.

Example itryit/laravel-ps-redis Config

    /** redisConfigName config is supported since version 2.2 */
    'redisConfigName' => 'redis', // your redis setting key name, 'redis' for default, this would be compatible with past versions

    'redis' => [

        /** the name of the redis node set */
        'nodeSetName' => 'your-sentinel-node-set-name',

        'cluster' => false,

        /** database config is supported since version 2.1 */
        'database' => 0, // redis database choice

        /** Array of sentinels */
        'masters' => [
            [
                'host' => 'sentinel-instance.domain.com',
                'port' => '26379',
            ],
            [
                'host' => 'sentinel-instance.domain.com',
                'port' => '26379',
            ]
        ],
    
        /** how long to wait and try again if we fail to connect to master */
        'backoff-strategy' => [
            'max-attempts' => 10, // the maximum-number of attempt possible to find master
            'wait-time' => 500,   // miliseconds to wait for the next attempt
            'increment' => 1.5, // multiplier used to increment the back off time on each try
        ]
    ];  

Example Laravel 5.4 Sentinel Config that I am trying to map to

return [
   // ...
    'redis' => [
        'client' => 'predis',
        'sentinel' => [
            'tcp://10.24.5.136:26379?timeout=0.100',
            'tcp://10.24.5.137:26379?timeout=0.100',
            'tcp://10.24.5.138:26379?timeout=0.100',
            'options' => [
                'replication' => 'sentinel',
                'service' => env('REDIS_SENTINEL_SERVICE', 'mymaster'),
                'parameters' => [
                    'password' => env('REDIS_PASSWORD', null),
                    'database' => 0,
                ],
            ],
        ],
    ],
];

Any help would be great!

Sep
07
2 years ago
Activity icon

Started a new conversation Is There A Method I Could Call To Get A List Of All Defined Gate Strings I Defined?

Is there a method I could call to get a list of all defined Gate strings (abilities) I defined?

Example:

Gate::define('update-post', ...); Gate::define('delete-account', ...);

Calling that method could return me something like ['update-post', delete-account']

Jun
29
2 years ago
Activity icon

Replied to Collect.js: Use Laravel Collections API In JavaScript.

How is it performance wise as compared to lodash

Jun
28
2 years ago
Activity icon

Replied to Laracast Subscription

That entitles your supervisor to a yearly subscription but it doesn't entitle you or your colleagues to a subscription. As that would be considered account sharing strictly speaking that is.

Still I know of several SAAS/content creators/founders being privately fine with users sharing their paid account with their family & a few friends but not beyond that.

So you may have to ask @JeffreyWay on his private stand on this.

Jun
26
2 years ago
Activity icon

Replied to Restricting 2FA Only For Users On Paid Plans

In my country, hardly anyone use an auth app. They rather receive an SMS or email and type the code in. That's what I know.

Jun
24
2 years ago
Activity icon

Started a new conversation A Private Area For Laravel Spark Internals Discussions

Hi @TaylorOtwell and @JeffreyWay

Sometimes I have questions to ask about the internals of Laravel Spark to better understand its internals.

However as Laravel Spark is a paid product, I hesitate to copy and paste code I see in the spark folder publicly in the forum. Raising it up as a github issue in laravel/spark doesn't feel right either as it isn't a bug.

So I would like to suggest a private Channel where we can do this more freely. Only users who have verified that they purchased Laravel Spark would be able to access.

Jun
23
2 years ago
Activity icon

Replied to Restricting 2FA Only For Users On Paid Plans

Well I'm planning a donationware app, pay what you want subscription model. Lowest is free. Followed by $1.etc

All users get everything except for features that might cause me money like SMS for 2FA.

For hosting I cover the cost myself of course.

Still pretty new to 2FA stuffs was only a consumer so far.

Activity icon

Replied to Restricting 2FA Only For Users On Paid Plans

If I'm not wrong Authy sends an SMS if the user does not have the authenticator app.

I think most people wouldn't bother with downloading with an authenticator app.

Activity icon

Replied to Restricting 2FA Only For Users On Paid Plans

Wouldn't sending SMS incur some costs?

Jun
22
2 years ago
Activity icon

Started a new conversation Restricting 2FA Only For Users On Paid Plans

Well I think 2FA is going to incur a little costs so I would like that feature to be only for paid monthly/yearly subscribers. What are the steps I need to take?

Apr
12
2 years ago
Activity icon

Started a new conversation How Do You Get Homestead And Spark To Work Well Together?

How do you get Homestead and Spark to work well together?

Seem to be lacking good instructions on this

Apr
07
2 years ago
Activity icon

Started a new conversation Anyway To Get Laravel Collections To Search With Binary Search?

Anyway to get Laravel Collections to search with binary search?

Or are there any package for me to do so

I was reading a huge text file with words sorted in ascending order.

I converted it to an array and then collection. search() works fine but I think it is linear.

An example use case will be getting a list of words starting with "ba"

Apr
06
2 years ago
Activity icon

Replied to How Do I Return A Single Computed Value From A Collection?

Hmm I used ->each but store the result in a external variable and return false. Yours look good too though I have yet to test. But does it perform early exit?

filter sound like it will go through all records than to leave once it is found. Or is laravel smart enough to do optimization behind the scene to do an early exit if it see first() used with filter?

I don't quite understand the reduce part though.

1 + boy (0) + bully (1) == 2

but what if there are more elements?

say [boy, bag, bully]

1 + boy (0) + bag (1) + bully (2) = 4

but bully should actually get me 3?

Activity icon

Replied to How Do I Return A Single Computed Value From A Collection?

@tykus reduce take produce a single value from all the values in the array

For me I just find the right value, do a bit of computation on it and return out from the function

I know my code doesn't reveal its purpose. It's for an job interview question so I don't feel appropriate pasting it verbatim (I have submitted my code to the interview yesterday though)

So let me think of another similar example

how about this

$dictionary = [
    'A' => ['animal', 'anybody'],
    'B' => ['boy', 'bully']

];

// Then my function

function getItemPositionInRespectiveAlphabetArray() {

        foreach ($this->dictionary as $words) {

            $itemKey = array_search($word, $words);

            if ($itemKey !=== FALSE) {
                return $itemKey + 1; // +1 because I don't want it to be 0 based
            }
        }

        return -1;

}

Is this clearer now?

So bully should give me 2, boy should give me 1, anybody should give me 2

I don't think reduce is the right way as it doesn't allow an early return the moment I found my value

Activity icon

Replied to How Do I Return A Single Computed Value From A Collection?

I want to use collections and avoid loop that why I ask the question

Activity icon

Replied to How Do I Return A Single Computed Value From A Collection?

Hi @starmatt but I only want to return 1 value. Map gives back 1 value for each item in the array and returns an array at the end

Activity icon

Started a new conversation How Do I Return A Single Computed Value From A Collection?

I guess my title is bad so help me suggest better ones. Basically I have code that look like this

function xyz() {

        foreach ($this->dictionary as $array) {

            $itemKey = array_search($item, $array);

            if ($itemKey !=== FALSE) {
                return $itemKey * 12345 // Some Computed value
            }
        }

        return -1;

}

I decide to turn it into a collection based code. But I can't figure out which collection functions to use. I thought of reduce but it doesn't sound right. Any tips?

Apr
04
2 years ago
Activity icon

Started a new conversation Is There Anything Like Java Streams In PHP That I Can Use With Laravel Collections?

Well I'm parsing a huge text file and doing filtering before returning result, so loading it all into memory may not be a good option.

I know in Java I can do something like a Stream then filter.etc

In Laravel is there something like this? Great if I could use it with laravel collections

Oct
31
2 years ago
Activity icon

Replied to Laravel /passport And Postman Gets All The Time ⌚ Unauthorised

Me too! all the online solutions I read is telling me to switch to Nginx but I want to fix this Authorization header issue in Passport with Apache!

Oct
29
2 years ago
Activity icon

Started a new conversation How To Force HTTP/1.1 Over HTTPS On Nginx

Hi,

Recently I am trying to conduct an experiment to compare the differences between http1 and http2, however, I faced the following issues.

I enabled https on both sites and I noticed that just by enabling ssl and serve my site over https with nginx, http2 is automatically enabled. Which is not what I want.

I want 1 of the site to be served over https but on HTTP/1.1 not HTTP/2

Is there any way to do that? Thank you

My server config is shown below

server {
    listen 443 ssl; # HTTP2 is used, how do I disable the use of HTTP2 !
 
    server_name mysite.ip-address.nip.io;

    root /home/myuser/myapp.com/http1site;
    index index.html index.htm;

    ssl_certificate /etc/ssl/nip.io/nip.io.crt;
    ssl_certificate_key /etc/ssl/nip.io/nip.io.key;

    charset utf-8;

    location / {
        try_files $uri $uri/ =404;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    include h5bp/basic.conf;
}
Activity icon

Replied to How Do Remove Nodejs 7 Ppa And Install Nodejs 6?

@willvincent I still need to know how to remove node7 ppa and node7 .etc at least.

Activity icon

Started a new conversation How Do Remove Nodejs 7 Ppa And Install Nodejs 6?

Hi,

Recently I followed instructions at the following site to download and install nodejs 7

https://github.com/nodesource/distributions

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
...

However I encountered difficulties later when some of the node packages I needed doesn't work on nodejs 7

But I'm not sure how to remove the ppa for nodejs 7 and install nodejs 6 instead.

Any help would be appreciated.

My server is on digitalocean running Ubuntu.

Oct
28
2 years ago
Activity icon

Started a new conversation Passport Password Grant Issue, Unauthenticated Despite Passing Token

Hi,

I'm trying to do Oauth password grant here and here are the steps I did and issues faced.

  1. First I used postman to grab my token

POST: http://my-app.dev/oauth/token

    'form_params' => [
        'grant_type' => 'password',
        'client_id' => '2',
        'client_secret' => 'blablabal',
        'username' => '[email protected]',
        'password' => 'my-password',
        'scope' => '*',
    ],

And I get a response back looking like this

{
  "token_type": "Bearer",
  "expires_in": -1477709422,
  "access_token": "shortened-access-token",
  "refresh_token": "shortened_refresh_token"
}

Everything looks fine so far, but when I proceed to access 1 of my protected routes

Route::group(['middleware' => ['auth:api']], function () {
    Route::get('/teams', 'Api\[email protected]'); // This 1
}
...

I got the following error

Illuminate\Auth\AuthenticationException Unauthenticated.

For extra information, I did pass in Headers 'Accept application/json' and Authorization Bearer token_here

What did I do wrong?