aligajani

aligajani

Member Since 5 Years Ago

London, UK

Experience Points
26,320
Total
Experience

3,680 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
456
Lessons
Completed
Best Reply Awards
1
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 6
26,320 XP
Jan
16
3 days ago
Activity icon

Replied to How Do You Standardize Your JSON Responses?

That is an overkill for what I wanted. So I used another one now, flug-responder. So good

Jan
15
4 days ago
Jan
08
1 week ago
Activity icon

Started a new Conversation What Do You Guys Use To Display A Loader Icon For A Component While Its HTTP Request Is Processing?

I was thinking something like this.

<show-loader>
   <component-that-makes-http-request/>
</show-loader>

It is quite painful to have a loading logic set in every component that makes HTTP requests, using data, this and that to set things to true and false after Promises resolve. I am sure you guys are using something more sublime, just curious.

Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

@themsaid I don't deploy from my machine but I guess you're right. Github Actions is overriding them. I have reached out to them and have't received a response yet. But I suspect it is indeed the case. The last time I deployed via my machine, I wasn't using any assets so have to retest.

Jan
06
1 week ago
Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

I have contacted them already, but no response yet. Maybe you should tweet them too, please. With your clout, I guess we are certain to get a faster response on Twitter. But thank you.

Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

@themsaid Thank you Mohamed for taking this up. In Github actions, I am indeed running vapor deploy.

I logged process.env and I don't see ASSET_URL in there. I however do see VAPOR_API_TOKEN.

name: Deploy to staging

on:
  push:
    branches:
      - development

jobs:
  vapor:
    name: Deploy to staging
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
      - uses: aligajani/[email protected]
        env:
          VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
        with:
          args: "deploy staging"

Jan
05
2 weeks ago
Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

Guys I talked to Mohammed too and he said to update the Vapor library, however it did not work, so I am using what Paul suggested.

Jan
04
2 weeks ago
Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

@fylzero Doesn't work.

I did update my environment files with MIX_ASSET_URL="${ASSET_URL}" and did vapor env:push production. Then ran the below from Github actions using vapor deploy production.

> @ production /github/workspace/.vapor/build/app
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

MIX_ASSET_URL=undefined
 DONE  Compiled successfully in 26430ms10:57:22 AM
Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

@paulmarshall I could do this Paul, but I am finding the right solution. I have reached out to Taylor and Mohamed. Thank you for your hack though. How are you using this in your app.js? As a computed or a method?

Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

Interesting. Let’s try this. Thanks

Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

I don’t think you understand what I’m trying to do here. You need to look at the assets part of Vapor documentation. Taylor states that Vapor injects the ASSET_URL on two occasions. The

Build step and the environment. The former is what I’m trying to figure out here. The code I’ve shown is literally what Taylor wrote in the documentation.

Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

You can actually use MIX_ environment variables to have that file pick up from a local .env file. It works during my local experiments.

Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

How did you pick it up in app.js? Ideally my goal is to prefix all assets from a computed value or method. What do you suggest ?

Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

It is working with those helpers but not if I reference process.env.ASSET_URL in my webpack.mix.js and then subsequently process.env.ASSET_PATH in my app.js.

Jan
03
2 weeks ago
Activity icon

Replied to Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

Vapor injects it but I am not sure why it won't work at the Mix level as it does work elsewhere like assets().

Activity icon

Started a new Conversation Why Doesn't Laravel Vapor Inject ASSET_URL In My Build Step?

This is from my Github action below. You can see that ASSET_URL is empty.

> @ production /github/workspace/.vapor/build/app
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

ASSET URL IS: 
 DONE  Compiled successfully in 26754ms11:23:07 PM

This is my code in webpack.mix.js. The ASSET_URL is not being injected.

// To deal with Laravel Vapor
if (mix.inProduction()) {
    const ASSET_URL = process.env.ASSET_URL;
    console.log("ASSET URL IS: " + ASSET_URL);

    mix.webpackConfig(webpack => {
        return {
            plugins: [
                new webpack.DefinePlugin({
                    "process.env.ASSET_PATH": JSON.stringify(ASSET_URL)
                })
            ],
            output: {
                publicPath: ASSET_URL
            }
        };
    });

However, assets() and mix() helpers in blade on index.blade.php work just fine.

Dec
30
2 weeks ago
Activity icon

Awarded Best Reply on Laravel Vapor - AWS Lambda Cold Boot

Vapor prewarms the app every 5 minutes. You don't need to do anything. AWS concurrency feature is more expensive and you shouldn't need it if your app has like a few K users at most. Right now, out of the box, Vapor achieves the pre-warm functionality using Cloudwatch events.

Dec
25
3 weeks ago
Activity icon

Awarded Best Reply on Anyone Figured Out Logging Using Laravel Vapor?

Okay I found the solution in case anyone runs into it after me.

Here's my logging.php configuration. Note stderr.

<?php

use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Log Channel
    |--------------------------------------------------------------------------
    |
    | This option defines the default log channel that gets used when writing
    | messages to the logs. The name specified in this option should match
    | one of the channels defined in the "channels" configuration array.
    |
    */

    'default' => env('LOG_CHANNEL', 'stack'),

    /*
    |--------------------------------------------------------------------------
    | Log Channels
    |--------------------------------------------------------------------------
    |
    | Here you may configure the log channels for your application. Out of
    | the box, Laravel uses the Monolog PHP logging library. This gives
    | you a variety of powerful log handlers / formatters to utilize.
    |
    | Available Drivers: "single", "daily", "slack", "syslog",
    |                    "errorlog", "monolog",
    |                    "custom", "stack"
    |
    */

    'channels' => [
        'stack' => [
            'driver' => 'stack',
            'channels' => ['vapor', 'bugsnag'],
            'ignore_exceptions' => false,
        ],

        'bugsnag' => [
            'driver' => 'bugsnag',
        ],

        'vapor' => [
            'driver' => 'stack',
            'channels' => ['stderr', 'papertrail'],
            'ignore_exceptions' => false,
        ],

        'single' => [
            'driver' => 'single',
            'path' => storage_path('logs/laravel.log'),
            'level' => 'debug',
        ],

        'daily' => [
            'driver' => 'daily',
            'path' => storage_path('logs/laravel.log'),
            'level' => 'debug',
            'days' => 14,
        ],

        'slack' => [
            'driver' => 'slack',
            'url' => env('LOG_SLACK_WEBHOOK_URL'),
            'username' => 'Laravel Log',
            'emoji' => ':boom:',
            'level' => 'critical',
        ],

        'papertrail' => [
            'driver' => 'monolog',
            'level' => 'debug',
            'handler' => SyslogUdpHandler::class,
            'handler_with' => [
                'host' => env('PAPERTRAIL_URL'),
                'port' => env('PAPERTRAIL_PORT'),
            ],
        ],

        'stderr' => [
            'driver' => 'monolog',
            'handler' => StreamHandler::class,
            'formatter' => env('LOG_STDERR_FORMATTER', "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"),
            'with' => [
                'stream' => 'php://stderr',
            ],
        ],

        'syslog' => [
            'driver' => 'syslog',
            'level' => 'debug',
        ],

        'errorlog' => [
            'driver' => 'errorlog',
            'level' => 'debug',
        ],

        'null' => [
            'driver' => 'monolog',
            'handler' => NullHandler::class,
        ],
    ],

];
Activity icon

Replied to Anyone Figured Out Logging Using Laravel Vapor?

Okay I found the solution in case anyone runs into it after me.

Here's my logging.php configuration. Note stderr.

<?php

use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Log Channel
    |--------------------------------------------------------------------------
    |
    | This option defines the default log channel that gets used when writing
    | messages to the logs. The name specified in this option should match
    | one of the channels defined in the "channels" configuration array.
    |
    */

    'default' => env('LOG_CHANNEL', 'stack'),

    /*
    |--------------------------------------------------------------------------
    | Log Channels
    |--------------------------------------------------------------------------
    |
    | Here you may configure the log channels for your application. Out of
    | the box, Laravel uses the Monolog PHP logging library. This gives
    | you a variety of powerful log handlers / formatters to utilize.
    |
    | Available Drivers: "single", "daily", "slack", "syslog",
    |                    "errorlog", "monolog",
    |                    "custom", "stack"
    |
    */

    'channels' => [
        'stack' => [
            'driver' => 'stack',
            'channels' => ['vapor', 'bugsnag'],
            'ignore_exceptions' => false,
        ],

        'bugsnag' => [
            'driver' => 'bugsnag',
        ],

        'vapor' => [
            'driver' => 'stack',
            'channels' => ['stderr', 'papertrail'],
            'ignore_exceptions' => false,
        ],

        'single' => [
            'driver' => 'single',
            'path' => storage_path('logs/laravel.log'),
            'level' => 'debug',
        ],

        'daily' => [
            'driver' => 'daily',
            'path' => storage_path('logs/laravel.log'),
            'level' => 'debug',
            'days' => 14,
        ],

        'slack' => [
            'driver' => 'slack',
            'url' => env('LOG_SLACK_WEBHOOK_URL'),
            'username' => 'Laravel Log',
            'emoji' => ':boom:',
            'level' => 'critical',
        ],

        'papertrail' => [
            'driver' => 'monolog',
            'level' => 'debug',
            'handler' => SyslogUdpHandler::class,
            'handler_with' => [
                'host' => env('PAPERTRAIL_URL'),
                'port' => env('PAPERTRAIL_PORT'),
            ],
        ],

        'stderr' => [
            'driver' => 'monolog',
            'handler' => StreamHandler::class,
            'formatter' => env('LOG_STDERR_FORMATTER', "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"),
            'with' => [
                'stream' => 'php://stderr',
            ],
        ],

        'syslog' => [
            'driver' => 'syslog',
            'level' => 'debug',
        ],

        'errorlog' => [
            'driver' => 'errorlog',
            'level' => 'debug',
        ],

        'null' => [
            'driver' => 'monolog',
            'handler' => NullHandler::class,
        ],
    ],

];
Activity icon

Started a new Conversation Anyone Figured Out Logging Using Laravel Vapor?

Papertrail works on local and never when deployed to Vapor.

'stack' => [
            'driver' => 'stack',
            'channels' => ['papertrail', 'bugsnag'],
        ],
Activity icon

Replied to Laravel Vapor - AWS Lambda Cold Boot

Vapor prewarms the app every 5 minutes. You don't need to do anything. AWS concurrency feature is more expensive and you shouldn't need it if your app has like a few K users at most. Right now, out of the box, Vapor achieves the pre-warm functionality using Cloudwatch events.

Activity icon

Replied to Logging In Laravel Vapor (Papertrail, Flare, Sentry - Nothing Is Working!)

I am having the same issue. Papertrail doesn't work. Bugsnag works. Any ideas on how to log at all?

Nov
27
1 month ago
Activity icon

Replied to Payment Gateway

You can use Stripe Checkout. Easily embeddable.

Activity icon

Started a new Conversation How To Make Laravel Valet Work Nicely With BrowserSync?

Has anyone made Laravel Valet (secure) work nicely with Browser Sync while using Laravel Mix. I am doing something like this but it keeps pointing me to https://shadow-api.test:3000 where as I simply want to omit the port.

mix.browserSync({
    proxy: 'shadow-api.test',
    host: 'shadow-api.test',
    open: 'external',
    https: {
        key: "/Users/aligajani/.config/valet/Certificates/shadow-api.test.key",
        cert: "/Users/aligajani/.config/valet/Certificates/shadow-api.test.crt"
    }
});

For your information, I am using the latest versions of everything, fresh install and intend on building a SPA (with token auth). I haven't had similar issues with BrowserSync before simply because I wasn't using Valet.

Nov
26
1 month ago
Activity icon

Replied to Payment Gateway

Use Cashier.

Nov
06
2 months ago
Activity icon

Replied to Any Vue Library That Could Help Me Normalize API Service Calls?

Firstly, thank you. This makes a lot of sense. Still wondering if there is a library to do all this? What happened to return new Promise resolve() reject() stuff? Am I living in the old world :)

Activity icon

Awarded Best Reply on How Do I Use Redis On QUEUE_CONNECTION In Laravel 6.4?

I fixed it by doing pecl install redis to add the missing extension. Now the php artisan queue:work actually works after having replaced the Redis in app.php to RedisManager. Also, I am fine with predis for just testing really.

However, there is one new problem now. The emails being sent have a localhost/ appended to every URL in that email, when the emails are being sent from the queue that is. Any idea why? Thank you for your replies.

Nov
05
2 months ago
Activity icon

Started a new Conversation Any Vue Library That Could Help Me Normalize API Service Calls?

Basically, I know I can make one myself, but I am surverying if there's any you know. I am imagining a common service for calling APIs which then specific resources feed into for get, post,patch,delete et. al, but normalized so if I have to change something in the core API calling process, I don't change dozens of files.

Oct
29
2 months ago
Activity icon

Replied to How Do I Use Redis On QUEUE_CONNECTION In Laravel 6.4?

Its set to my-app.test

Activity icon

Replied to How Do I Use Redis On QUEUE_CONNECTION In Laravel 6.4?

Well here's the logo code, it worked fine before, but now, it and along with other URLs, all appended with localhost. Just because I am sending that email from the Redis queue. Strange never happened in Laravel 5.

                <img style="width:300px;" src="{{asset('assets/TRIMMED-HiRes-lb-TRANS.png')}}" alt="{{config('app.name')}}"

Activity icon

Replied to How Do I Use Redis On QUEUE_CONNECTION In Laravel 6.4?

I fixed it by doing pecl install redis to add the missing extension. Now the php artisan queue:work actually works after having replaced the Redis in app.php to RedisManager. Also, I am fine with predis for just testing really.

However, there is one new problem now. The emails being sent have a localhost/ appended to every URL in that email, when the emails are being sent from the queue that is. Any idea why? Thank you for your replies.

Activity icon

Replied to How Do I Use Redis On QUEUE_CONNECTION In Laravel 6.4?

@jaytee @sinnbeck Below is the error when I set QUEUE_CONNECTION=redis.

[2019-10-29 10:03:37] local.ERROR: Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension. {"exception":"[object] (LogicException(code: 0): Please remove or rename the Redis facade alias in your \"app\" configuration file in order to avoid collision with the PHP Redis extension. 

Also to add further, I have "predis/predis": "^1.1", on my composer.json and I am using php7.3 with redis-client and redis-server installed via Brew. I am not sure I am missing something? I have been able to make things work fine on my older laravel versions using php5.6.

Activity icon

Started a new Conversation How Do I Use Redis On QUEUE_CONNECTION In Laravel 6.4?

  1. It throws errors if I use redis because of some naming conflict.
  2. I am also implementing ShouldQueue and Queable in the Notifications.
Oct
07
3 months ago
Activity icon

Replied to How Can I Send Verification Emails But Without Forcing User To Verify Before Login?

All my routes are below.

<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group(['middleware' => 'auth:api'], function () {
    Route::post('logout', 'Auth\[email protected]');

    Route::get('/user', function (Request $request) {
        return $request->user();
    });

    Route::patch('settings/profile', 'Settings\[email protected]');
    Route::patch('settings/password', 'Settings\[email protected]');
});

Route::group(['middleware' => 'guest:api'], function () {
    Route::post('login', 'Auth\[email protected]');
    Route::post('register', 'Auth\[email protected]');
    Route::post('password/email', 'Auth\[email protected]');
    Route::post('password/reset', 'Auth\[email protected]');
    Route::post('email/verify/{user}', 'Auth\[email protected]')->name('verification.verify');
    Route::post('email/resend', 'Auth\[email protected]');
    Route::post('oauth/{driver}', 'Auth\[email protected]');
    Route::get('oauth/{driver}/callback', 'Auth\[email protected]')->name('oauth.callback');
});

Activity icon

Replied to How Can I Send Verification Emails But Without Forcing User To Verify Before Login?

I am not so not sure how I can make it optional.

Route::group(['middleware' => 'guest:api'], function () {
    Route::post('login', 'Auth\[email protected]');
)};
Activity icon

Started a new Conversation How Can I Send Verification Emails But Without Forcing User To Verify Before Login?

If I use MustVerifyEmail on Laravel 6 at the User model, it sends the email but also blocks from logging. I want to give the user the ability to login and then verify at a time of their choosing but still send the verification email upon registration.

Oct
06
3 months ago
Activity icon

Started a new Conversation Is There A Way To Maintain One Scheme File Rather Than Having Many Migration Files?

It becomes a pain in the long run. I just want to edit the existing single Migration file and rerun it for reflecting changes.

Oct
05
3 months ago
Activity icon

Replied to How Do You Standardize Your JSON Responses?

Is that good even though not all my json responses are going to be eloquent models?

Oct
04
3 months ago
Activity icon

Started a new Conversation How Do You Standardize Your JSON Responses?

There are many ways, like {message, status, data} but I am curious to know how do you handle this, whether using a separate package or a internal laravel feature to ensure all json responses are consistent for the frontend to consume, and predictable.

Oct
03
3 months ago
Activity icon

Started a new Conversation Adding Items To Pivot Table And Main Table

For example I have a user who can create projects. But projects can be maintained by other users that exist in the user-project pivot table. What is the ideal way to create the project in the project table and at the same time create an entry in the pivot table?

Activity icon

Started a new Conversation What Is Your Vue Folder Structure Like?

Assume Im creating a separate web app that hooks up to an API. Do you have a common HTTP calling service and then a separate API calling services for each of the entity on the backend. Generally interested in folder structure.

Sep
26
3 months ago
Activity icon

Started a new Conversation Anyone Tried Using Vapor For Just Publishing Static Site Yet?

So I dont have to use Netlify.

Activity icon

Replied to How Do You Guys Structure Your Applications?

I have decided now that with Laravel Vapor up and running, I will be keeping my backend and frontend in the same folder. API will be still stateless, frontend will still be consuming JWT auth. All same stuff but same folder, utilising the power of atomic deployments with S3/CDN assets working out of the box.

If my project scales and I bring more team members, I will seperate it to api.project.com (api) and app.project.com (client). There's nothing wrong with this approach given ChipperCI has also rolled out.

Sep
19
4 months ago
Activity icon

Commented on Frontend Authorization Brainstorming

You need to denormalise it of course. Pivot tables.

Sep
17
4 months ago
Activity icon

Commented on Don't Forget Readability

Yeah this took me some time to understand back in the day ;)

Activity icon

Replied to How Do You Guys Structure Your Applications?

I was particular discussing the frontend and backend separation.

Activity icon

Started a new Conversation How Do You Guys Structure Your Applications?

I have two options:

  1. Have frontend and backend in original folder structure so one project.
  2. Separate frontend and backend.

I have tried 2 in the past but I think it has to be deployed at the same time to avoid mishap. Therefore I am considering option 1, but I want to know if that is too naive. I want to learn from you all. I think with Laravel Vapor deploying assets to S3/CDN, 1 sounds very appealing to me now, so my entire app is deployed instantly without me having to maintain API codebase and Client codebase in separate project folders.

Sep
15
4 months ago
Activity icon

Replied to Use Auth Scaffolding As API

No I still want the use Laravel 6

Activity icon

Started a new Conversation Use Auth Scaffolding As API

Hey guys, is it possible to setup the auth scaffolding on laravel 6 as an API so I can use it with JWT /tymon and a decoupled front end ? Ideally I want to keep the original code