CTO / Software Architect at Agent Quote

Member Since 2 Years Ago

Experience Points
26,580
Total
Experience

3,420 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
258
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • Community Pillar

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

Level 6
26,580 XP
Mar
16
2 months ago
Activity icon

Replied to Careful, Laravel Commands Are Not Careful

@jlrdw let's get beyond the git and backup stuff, as this is clear that we ALL must do this. The point now, is to read my last post and to reflect on that. There are drastic changes to the UI, by the way. That is what happened when I used the artisan command to install a newer scaffolding that will break, for one because it overwrites files all over the place... but what I am referring to, at this point, is to building into the either/both the practices to create more interfaced libraries that don't just make it or break-it code that already exists = ). Well... please just read my previous post = )

Cheers mate!

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

Wow! Thanks for all your input/energy on this post!

Lol, you guys are all correct :), I do think that frameworks should be more backwards compatible. It is true that I should use git and believe me "I do," but for a project I was working on, this one... I did not push it yet, that was my bad! None-the-less, it is quite important to be backwards compatible. Sorry @taylorotwell, it is not your fault, we have all been contributing to the big mess of backwards compatibility :(.

See this Wikipedia article: https://en.wikipedia.org/wiki/Backward_compatibility#:~:text=Backward%20compatibility%20can%20be%20used,value%20of%20supporting%20older%20software.

Although functionality (INTERNALLY) might change, we should do more to keep things working even when the way things work inside change. Also, it might be a SMART idea to include a feature to add a change and then add a switch that can turn on/off a new package that was introduced.

Similar to a version control system, their could co exist a version control like library that could allow versioning of builds on a development level, not a GIT level, but similar, maybe even use git to do this for us in the background on another specified path to backup all things before running a package install, either through composer or artisan commands.

Guys/Gals, what I see in the big picture is that when working on LARGE projects, whatever you interpret as LARGE, being able to easily upgrade to the latest releases (versions) should be able to do so without having to refactor(re-code) your projects. The TRUTH is that when a feature that was popular is just removed or is changed (DRASTICALLY) then you are faced with a decision to DROP the current framework, or write/hack your own version to work with your existing system (usually a project that grows becomes more of a system than just a project). We/Company's/Bosses' all want to be able to use that latest feature, but when faced with constant upgrades and issues with backwards compatibilities it is so hard to do so. Should it be this way? Taking a look at this article https://medium.com/ironkeel/breaking-backwards-compatibility-81c7986f234b we/you/me find it a problem to have to always be chasing the updates and keeping our System relevant with today's standards and technologies.

I, for one, think that being relevant without having to rewrite layers(changing code everywhere) of code, but having procedures/rules in place that would allow even older code to conform to new changes, via interfaces, is not only ideal but a necessary evil (must be implemented to save the hell that follows with upgrades/updates) and possibly even be the right thing to do (the way to go) moving forward.

Of course, I am only one person, but I think that many of you share some of the same sentiment mentioned above.

What are your guys/gals thoughts? @jeffreyway, @taylorotwell, @everyone!?

Feb
16
3 months ago
Activity icon

Replied to Careful, Laravel Commands Are Not Careful

This is just like big tech., deciding the final outcome... I don't agree. You might be Level 50, but you guys should let people see this as it is important truth. The truth is that it is now up to the programmer / user of of Laravel to protect him/her of any issues, as Laravel commands will not do it (check for) you. You cannot just keep good PR for your website, you have to also keep information that states the truth, that many tools that are made available at the command line will mess up your stuff if you run them. This is not my only experience of this with the artisan command. The artisan command can be quite dangerous if you are not aware of what a command might do. Use Certain Artisan Commands "at your projects own Risk."

Feb
14
3 months ago
Activity icon

Replied to Careful, Laravel Commands Are Not Careful

@trin, Your just jumping over the truth and trying to side swipe it! You are not facing the situation head on! And no, you cannot say that a starter kit is means to destroy all things in directories. That is not even what a starter kit is.

[https://dictionary.cambridge.org/dictionary/english/starter-kit]

The practice of courtesy or warning and giving clear warning is no longer important! It needs to be recovered back into the minds of people like @taylorotwell

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

that is not a clear indication. It does not tell you how far the install will go. Does it say we will override your existing installation and any file or directory could be changed without warning? Scaffold does not mean that anything in your project can be overridden and you know that too. This install does more than it warns. That means something. @taylorotwell has overlooked how important it is to warn and how to say what exactly his install is going to do. If it is going to override not only 1 file but many files that change everything! This has been his practice these days, to not care and go ahead and do that! This is wrong! We are not installing another version of Laravel. Versioning tells you how serious an override is but installing a package does not tell you what that install is going to do. It is for that reason you must provide the appropriate warnings with the correct wording as well.

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

@trin, how about when you bring in your computer to get it repaired, because it has a os problem. So, to save time, because it is going to take a long time to fix it, I just format the drive and reinstall the OS so that when you pick it up that your computer is working again, even though all your data was wiped for convenience! Oh well, we did not tell you but your computer is working now! What would happen next? All trouble would ensue and would be responsible, because I wiped out your data and I did not specifically tell you and ask you if that was okay! In this way, it is quite similar situation. You might say, well this is application stuff... there is no time when it is okay to not warn the person of what is about to happen, unless you can prove that they fully understand that by doing so would make all things gone!

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

How am I wrong? You should not just override people's code and file structure to install your own! You need to always take into account courtesy!!!!!!!!!

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

No Framework, should have the right to override everything! Are you telling me that this guy @TaylorOtwell just needs to create new stuff, but not be expected to add an if condition in a script that allows the user a chance to choose if he wants to wipe out his/her existing settings, and files!? That install wipes out your app.js file your bootstrap.js your routes/web.php any files sitting inside the views/ folder that might have the same name as his stuff! This attitude that he does not need to think about courtesy during install is very wrong!

@TaylorOtwell, you need to be called out! You should not just override people's code and file structure to install your own! You need to always take in to account that not every person is going to understand the way you think! It is not even enough to say read the documentation, because there 1000's of tutorials and places to read on Laravel documentation that does not say in plain English: "By installing this, or by running this command, we will be overwriting so many files that you stuff will no longer work after we install X feature!!!!"

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

This install not only overwrites some files it changes even your complete configuration, 100%. It does not take in account anything! It overwrites everything!

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

Scaffolding does not necessarily mean to overwrite files where and whenever it so desires. Scaffolding means that they will create something to make it easier on you, it does not to allow them to overwrite things that are already there, especially without warning!!!!!!!!! Many programs warn you! Many. Just Laravel, does not!!!!!

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

So you are saying that Laravel, should. not warn you of overwritting many files and that it should not check, because big tech does not need to do things like this, they leave up to the programmer to trust or not to trust and up to the programmer to prevent him/herself from not getting screwed by the big tech who already knows that courtesy is a thing of the past and thus does not need to, nor should it warning of things that it will do on your servers/ computers?????! Like overwriting files without warning!

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

The more I look the more I see that Laravel overwrote more than just some files... they wrote over many files. This sucks. I can say for sure that Laravel, may create great CMS but they at the same time not responsible. They have destroyed all the work!!! Laravel you are really beginning to be an organization that we can trust less and less.... you don't even follow basic principle of courtesy!

Activity icon

Started a new Conversation Careful, Laravel Commands Are Not Careful

Be very careful with Laravel. Laravel does not check things before overwriting your existing files. I worked for 1 month on a project and just wanted to use users and registration. Laravel overwrote all my existing workflow without warning that there already exists files. Laravel, does not warn. They will overwrite all your important files if you run their commands.

Running:

php artisan breeze:install npm install && npm run dev

Will overwrite your routes/web.php file, without warning.

Guys, this is pretty shady. Laravel just because you are growing does not mean that you don't have the responsibility with your power to not inform users your dangerous installation steps that wipe out your existing installation data.

It really sucks that a Framework like Laravel would not care to do these small things to save huge headaches.

I know some of you would say that it is someone's fault for not backing up everything under the sun, but hey Laravel you cannot just assume that. You have to show some responsibility.

It really sucks that Laravel did not give me any pre-warning before destroying my entire build process and even overwriting crucial files!!!!!!!!!!!!!!!!!

Dec
11
5 months ago
Activity icon

Started a new Conversation Laravel 8 - Passport - User Login Issuing Access Token - Help

Installed Laravel Passport and Setup Signup/Login below

When I hit the http://localhost:8000/api/auth/login endpoint to login using same credentials as signup, I get the error, listed at the end of this document. Please advise :)

routes/api.php


Route::namespace('Api')->group(function() {

    Route::prefix('auth')->group(function() {

        Route::post('login', [\App\Http\Controllers\Api\AuthController::class, 'login']);
        Route::post('signup', [\App\Http\Controllers\Api\AuthController::class, 'signup']);

    });

    Route::group([
        'middleware' => 'auth:api'
    ], function() {
        Route::get('helloworld', [\App\Http\Controllers\Api\AuthController::class, 'index']);
    });

});

App\Http\Controllers\Api\AuthController.php

<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\PassportUser;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class AuthController extends Controller
{

    const SIGNUP_NAME_FIELD_VALIDATION = 'required|string';
    const SIGNUP_FIELD_VALIDATION = 'required|string|email|unique:users';
    const EMAIL_VALIDATION = 'required|string|email';
    const SIGNUP_FIELD_PASSWORD_CONFIRMED_VALIDATION = 'required|string|confirmed|min:16';
    const PASSWORD_VALIDATION = 'required|string|min:16';

    public function index(): string
    {
        return 'Hello Api';
    }

    protected function generateAccessToken($user)
    {
        $token = $user->createToken($user->email.'-'.now());

        return $token->accessToken;

    }

    public function signup(Request $request): \Illuminate\Http\JsonResponse
    {
        $request->validate([
            'name' => self::SIGNUP_NAME_FIELD_VALIDATION,
            'email' => self::SIGNUP_FIELD_VALIDATION,
            'password' => self::SIGNUP_FIELD_PASSWORD_CONFIRMED_VALIDATION
        ]);

        $user = PassportUser::create([
            'name' => $request->name,
            'email' => $request->email,
            'password' => bcrypt($request->password)
        ]);

        return response()->json([
            "message" => "User registered successfully",
            "user" => $user
        ], 201);
    }

    public function login(Request $request): \Illuminate\Http\JsonResponse
    {
        $credentials = $request->validate([
            'email' => self::EMAIL_VALIDATION,
            'password' => self::PASSWORD_VALIDATION
        ]);

        if ( ! Auth::attempt($credentials)) {

            return response()->json([
                'message' => 'Invalid email or password'
            ], 401);


        }

        $user = $request->user();
        $token = $user->createToken('Access Token');
        $user->access_token = $token->accessToken;

        return response()->json([
            'user' => $user,
            'message' => 'Authenticated successfully'
        ], 200);

    }
}

Postman - Sign Up - Successful

Chrome Inspect Element

View Image Full Size

Postman - Logging In - Error Response

League\OAuth2\Server\Exception\OAuthServerException: Client authentication failed in file /Users/niran/Code/PersonalProjects/dzineer/acme/laravel-8-acme-project/vendor/league/oauth2-server/src/Exception/OAuthServerException.php on line 154

#0 /Users/niran/Code/PersonalProjects/dzineer/acme/laravel-8-acme-project/vendor/league/oauth2-server/src/Grant/AbstractGrant.php(185): League\OAuth2\Server\Exception\OAuthServerException::invalidClient(Object(Nyholm\Psr7\ServerRequest)) #1 /Users/niran/Code/PersonalProjects/dzineer/acme/laravel-8-acme-project/vendor/laravel/passport/src/Bridge/PersonalAccessGrant.php(21): League\OAuth2\Server\Grant\AbstractGrant->validateClient(Object(Nyholm\Psr7\ServerRequest)) #2 /Users/niran/Code/PersonalProjects/dzineer/acme/laravel-8-acme-project/vendor/league/oauth2-server/src/AuthorizationServer.php(198): Laravel\Passport\Bridge\PersonalAccessGrant->respondToAccessTokenRequest(Object(Nyholm\Psr7\ServerRequest), Object(League\OAuth2\Server\ResponseTypes\BearerTokenResponse), Object(DateInterval)) #3 /Users/niran/Code/PersonalProjects/dzineer/acme/laravel-8-acme-project/vendor/laravel/passport/src/PersonalAccessTokenFactory.php(119): League\OAuth2\Server\AuthorizationServer->respondToAccessTokenRequest(Object(Nyholm\Psr7\ServerRequest), Object(Nyholm\Psr7\Response)) #4 /Users/niran/Code/PersonalProjects/dzineer/acme/laravel-8-acme-project/vendor/laravel/passport/src/PersonalAccessTokenFactory.php(74): Laravel\Passport\PersonalAccessTokenFactory->dispatchRequestToAuthorizationServer(Object(Nyholm\Psr7\ServerRequest)) #5 /Users/niran/Code/PersonalProjects/dzineer/acme/laravel-8-acme-project/vendor/laravel/passport/src/HasApiTokens.php(67): Laravel\Passport\PersonalAccessTokenFactory->make(1, 'Access Token', Array) #6 /Users/niran/Code/PersonalProjects/dzineer/acme/laravel-8-acme-project/app/Http/Controllers/Api/AuthController.php(70): App\Models\User->createToken('Access Token')

Examples that supposed to work:

Laravel 7|8 REST API with Passport Authentication Tutorial | Supposed to work.

Laravel 8 REST API with Passport Authentication Tutorial Example | Supposed to work.

Has Laravel 8.x changed so that these examples don't work anymore?

Please advise! You Guys are Awesome!!!

Thanks!!!!!