m615

Owner / Software Engineer at 615io

Member Since 10 Months Ago

Nashville, TN

Experience Points
3,910
Total
Experience

1,090 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
26
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 1
3,910 XP
Apr
07
6 days ago
Activity icon

Started a new Conversation 502 Bad Gateway Nginx On Heroku

I have two laravel applications hosted on heroku. One is my API for a laravel ecommers site and the other is the actual larval ecomm site.

All was working well until today and I'm not sure what happened.

I'm making a request for locations via an api call. I'm able to hit the API directly with Postman and I do not get a 502 error at all.

The ecomm laravel app controller that makes the request looks like this.

	public function getProviderLocations(Request $request)
    {
        $response = Http::post(env('API_BASE').'provider-locations', [
            'address' => $request->address,
            'distance' => $request->distance,
            'site' => env('ORG_DOMAIN_ID')
        ]);

        $data = json_decode($response->getBody(), true);

        return redirect()->back()->with('location_data', $data );
    }

EDITED I Found the solution. The use of redirect()->back() was causing the 502 issue. switching it to view()->with() resolved the 502 error.

Mar
31
1 week ago
Activity icon

Awarded Best Reply on Trying To Query Geolocation Using SelectRaw With My ShippingAddress Model

I actually found a solution in this post. https://laracasts.com/discuss/channels/eloquent/how-to-store-locations-with-laravel-and-eloquent?page=1#reply=700933

here is what My updated code looks like.

$addresses = DB::select('SELECT * FROM shipping_addresses WHERE
                                lat BETWEEN ('. $lat .' - ( '. $circle_radius .' *0.018)) AND ('. $lat .'  + ('. $circle_radius .' *0.018)) AND
                                lng BETWEEN ('. $lng .'  - ('. $circle_radius .' *0.018)) AND ('. $lng .'  + ('. $circle_radius .' *0.018));');

Activity icon

Replied to Trying To Query Geolocation Using SelectRaw With My ShippingAddress Model

I actually found a solution in this post. https://laracasts.com/discuss/channels/eloquent/how-to-store-locations-with-laravel-and-eloquent?page=1#reply=700933

here is what My updated code looks like.

$addresses = DB::select('SELECT * FROM shipping_addresses WHERE
                                lat BETWEEN ('. $lat .' - ( '. $circle_radius .' *0.018)) AND ('. $lat .'  + ('. $circle_radius .' *0.018)) AND
                                lng BETWEEN ('. $lng .'  - ('. $circle_radius .' *0.018)) AND ('. $lng .'  + ('. $circle_radius .' *0.018));');

Activity icon

Replied to How Do I Query By Geolocation In Laravel 5?

I found this to be a great solution the solution above kept giving me an SQL out of range error.

Mar
30
2 weeks ago
Activity icon

Started a new Conversation Trying To Query Geolocation Using SelectRaw With My ShippingAddress Model

I'm trying to build a search so that a user can put in a zip code and we search a 20 mile radius in order to get locations close to them.

I've followed this example online and modified it to fit my needs.

I'm using this articles Eloquent model example https://www.techalyst.com/posts/laravel-find-nearest-restaurants-from-certain-gps-latitude-and-longitude

My code looks like this.

$zipcode = $request->zipcode;

        $zip = ZipCode::where('zip', $zipcode)->first();

        if($zip)
        {
            $radius = 20;
            $latitude = $zip->lat;
            $longitude = $zip->lng;

            /*
             * replace 6371000 with 6371 for kilometer and 3956 for miles
             */
            $addresses = ShippingAddress::selectRaw("id, business_name, address, address2, city, state, zip, lat, lng, distance,
                ( 3956 * acos( cos( radians(?) )
                * cos( radians( lat ) )
                * cos( radians( lng ) - radians(?)) + sin( radians(?) )
                * sin( radians( lat ) ) )) AS distance", [$latitude, $longitude, $latitude])
                ->having("distance", "<", $radius)
                ->groupBy('shipping_addresses.id')
                ->offset(0)->limit(20)->get();

I do not get any error however I don't get any results.

My zip_codes table has a lat / lng for each zip code and the addresses in my shipping_addresses table have lat / lng locations that are either identical as the location being used to do the radius search or they should be within a 20 mile radius for testing purposes.

It's worth mentioning that my query was complaining about not having a "distance" column in the shipping_addresses table, so I added that. I also set the column to nullable so I'm not sure if that's causing the issue or not. the article reference above doesn't say anything about the distance column being required or what value needs to be in the column or even what the column type needs to be.

Mar
24
2 weeks ago
Activity icon

Awarded Best Reply on How Do I Upload Larger Files To S3?

I found this package for Nova and it solved my problem. Very easy to implement and use.

https://novapackages.com/packages/ahmedkandel/nova-s3-multipart-upload

Activity icon

Replied to How Do I Upload Larger Files To S3?

I found this package for Nova and it solved my problem. Very easy to implement and use.

https://novapackages.com/packages/ahmedkandel/nova-s3-multipart-upload

Mar
01
1 month ago
Activity icon

Replied to How Do I Upload Larger Files To S3?

Yes I understand that, however what I'd like to know is ... Is there a way to configure the File::make field to upload using chunks ?

Activity icon

Started a new Conversation How Do I Upload Larger Files To S3?

I have created a MediaAsset model and resource in my project for users so they can attach a asset to a particular product or page.

I have the FileStorage configured to use my s3 bucket and all is working great. I get an error if the file is too large to upload. My users will need the ability to upload videos and images.

Is there a way to configure the File::make field to use s3 file streaming or is there some other configuration or solution I need to consider?

Feb
20
1 month ago
Activity icon

Awarded Best Reply on Frustrating 419 | Page Expired On Login Using Jetstream

THANK YOU !!! THIS WORKED.

In AppServiceProvider boot method I put the following.

public function boot()
    {
        if($this->app->environment('production') || $this->app->environment('staging'))
        {
            \URL::forceScheme('https');
        }
    }
Activity icon

Replied to Frustrating 419 | Page Expired On Login Using Jetstream

THANK YOU !!! THIS WORKED.

In AppServiceProvider boot method I put the following.

public function boot()
    {
        if($this->app->environment('production') || $this->app->environment('staging'))
        {
            \URL::forceScheme('https');
        }
    }
Activity icon

Replied to Frustrating 419 | Page Expired On Login Using Jetstream

Maybe a stupid question. How do I ensure that the login route uses https? I noticed a setting in the in session.php you can set 'http_only' => false,. Is there any other application level settings that can be set based on environment to force the use of https:// no matter what. I would like to make sure that locally the app does not have to use https unless there is an easy solution for running local host on https as well.

keep in mind I switch between windows and macos locally quite a lot.

Activity icon

Replied to Frustrating 419 | Page Expired On Login Using Jetstream

Ok, interesting. I'll give this try and see if that's the issue.

Feb
19
1 month ago
Activity icon

Replied to Frustrating 419 | Page Expired On Login Using Jetstream

I am setting the session domain in the .env. Locally it is set to 127.0.0.1 and in production I have it set to a subdomain 'example.mydomain.com'

my session config is is using db rather than cookie.

Activity icon

Replied to Frustrating 419 | Page Expired On Login Using Jetstream

I took a look at the Jetstream form that is used for user login and it does have a @csrf

<form method="POST" action="{{ route('login') }}">
            @csrf

            <div>
                <x-jet-label for="email" value="{{ __('Email') }}" />
                <x-jet-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
            </div>

            <div class="mt-4">
                <x-jet-label for="password" value="{{ __('Password') }}" />
                <x-jet-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="current-password" />
            </div>

            <div class="block mt-4">
                <label for="remember_me" class="flex items-center">
                    <input id="remember_me" type="checkbox" class="form-checkbox" name="remember">
                    <span class="ml-2 text-sm text-gray-600">{{ __('Remember me') }}</span>
                </label>
            </div>

            <div class="flex items-center justify-end mt-4">
                @if (Route::has('password.request'))
                    <a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ route('password.request') }}">
                        {{ __('Forgot your password?') }}
                    </a>
                @endif

                <x-jet-button class="ml-4">
                    {{ __('Login') }}
                </x-jet-button>
            </div>
        </form>
Activity icon

Replied to Frustrating 419 | Page Expired On Login Using Jetstream

I'm using the built in Jestream form so I'm assuming they have the @csrf token as part of the form.

Feb
18
1 month ago
Activity icon

Started a new Conversation Frustrating 419 | Page Expired On Login Using Jetstream

I have a laravel 8 application that I'm using Nova on. I've also implemented Jetstream login so that I can use it's tokens and auth system for an external application.

I've setup nova's auth driver in nova.php config to use Jetstream as it's auth driver.

If I run the application locally on localhost all works really well.

Once I deploy the application to production I always get 419 | Page Expired when trying to login using the same browser. I've tried clearing my cache, private browsing. The only time I can login without getting the error is if I use a completely different browser such as FF or Edge on windows. I use Chrome 99% of the time.

I'm really at a loss for why this is happening and have run out of ideas on why I continue to get this 419 | Expired message. To be clear, I see the login form, fill it out and click submit. Then I receive the 419 message.

Feb
17
1 month ago
Activity icon

Replied to Can I Preform A Nova Action On Creation Or Update Of A Resource?

Question ... is there a method that will be called on an Observer no matter what? It would be nice to have one method and then check to see what type of event was called and perform different operations?

Example for my situation:

Any time the Page model is changed I want to check to see if the "is_homepage" boolean is set to true. If so I want to update all other pages to be set to false.

If Page that "is_homepage' set to true is "deleted" I want to throw an error.

Activity icon

Replied to Can I Preform A Nova Action On Creation Or Update Of A Resource?

Perfect! Thank you. This will be the perfect solution

Feb
16
1 month ago
Activity icon

Started a new Conversation Can I Preform A Nova Action On Creation Or Update Of A Resource?

I have a Page resource in Nova that has an is_homepage boolean. If a User marks the Page as homepage true I would like to perform an action on saving or update in order to mark any other pages in the database that were previously set to the homepage as false?

What is the best way to accomplish this?

I'd really like to Query all other pages in the DB and perform the action before I update or save the new page as the new homepage.

Here are the steps I would like to perform.

/// User is creating or updating a Page resource
Boolean::make('Is Homepage') //sets to true

///User clicks create or update and just before update or save the following function runs

function() {
  $pages = Page::where('is_homepage', true)->get();
  
  foreach($pages as $page)
  {
      $page->is_homepage = false;
      $page->save();
  )
}

//after this action runs the update to the new or existing object is preformed
Activity icon

Replied to What Does My BelongsToMany Error (violates Foreign Key Constraint

I was able to resolve my issue. I changed the column type on the 'id' row in both models to be increment rather than id().

I also noticed that I had to change my pivot table name from 'featured_content_pages' to 'featured_content_page'.

Finally I also simplified my return $this->belongsToMany( ModelName::class); and removed all the other arguments. Now everything works as intended.

Feb
15
1 month ago
Activity icon

Started a new Conversation What Does My BelongsToMany Error (violates Foreign Key Constraint

I'm using nova to manage a Many to Many relationship between my Pages table and my Featured Content table in the database. I setup a table called featured_content_pages in order to keep track of the Many to Many relationship. It seems to work on first use however it seems that it gets confused at the incramenting of the pages table and trys to map to a page_id that does not exist in the DB yet. Here is a short video of the error in Nova that I receive.

https://drive.google.com/file/d/1jBxO0KZ64XuTxAQVuPgb_5T20YUjDBbi/view?usp=sharing

Here is the migration file of the table I created for mapping the many to many relationship.

Schema::create('featured_content_pages', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('page_id');
            $table->unsignedBigInteger('featured_content_id');
            $table->foreign('page_id')
                ->references('id')
                ->on('pages')
                ->onDelete('cascade');
            $table->foreign('featured_content_id')
                ->references('id')
                ->on('featured_content')
                ->onDelete('cascade');

        });

Here is what my Pages model looks like

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Page extends Model
{
    use HasFactory;

  

    public function featured_content()
    {
        return $this->belongsToMany(
            FeaturedContent::class,
            'featured_content_pages',
            'featured_content_id',
            'page_id' );
    }
}

Here is what my Featured Content model looks like

<?php

namespace App\Models;

use Hamcrest\Thingy;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class FeaturedContent extends Model
{
    use HasFactory;

    protected $table = 'featured_content';

    public function pages()
    {
        return $this->belongsToMany(
            Page::class,
        'featured_content_pages',
        'page_id',
        'featured_content_id');
    }

    public function media_asset()
    {
        return $this->belongsTo(MediaAsset::class);
    }
}

Jan
26
2 months ago
Activity icon

Started a new Conversation Why Do I Get A 419 | Page Expired When Logging In To Nova On My Staging Enviroment?

I'm running Nova locally and it's turning out to be a great solution. I have an annoying issue that I can't seem to figure out.

When I ship to my staging environment and try to login I get a 419 | Page expired message however if I use a different browser than the one I'm using locally, login works just fine. I'm assuming this has something to do with sessions?

How can I make sure there isn't a conflict with session when running the same browser from local to staging?

Activity icon

Started a new Conversation How Do I Package An Artisan Command In Order To Share It With The Community?

I created my first artisan command that allows me to set all of my environment variables all at once if you are using Heroku to host your laravel app.

For me this was really handy because I can put all my different Heroku environment vars in a json file and then call one command and set all or I can choose a single app on heroku and it will run through and update them all at once.

Anyway, I wasn't sure if creating a laravel package was the right way to distribute this or if there is some other preferred method.

Jan
08
3 months ago
Activity icon

Started a new Conversation Is There Any Recommended Resources For Quickly Launching A Blog On Heroku?

I am a heavy Heroku user. I would like to spin up a blog and I want to stay away from wordpress. I looked at Ghost that is written in Node.js but is really well supported for running on Heroku.

I'd prefer to spin up a Laravel blogging app if there is one that is easy to configure to use S3 for image hosting and so forth.

Could I get some recommendations from this group if such a Laravel repo already exists. Prefer that it be running version 7.x or above.

Dec
26
3 months ago
Activity icon

Replied to What Is The Proper Way To Have A BelongsToMany / HasOne Field

That did the trick. Thank you.

Dec
25
3 months ago
Activity icon

Started a new Conversation What Is The Proper Way To Have A BelongsToMany / HasOne Field

I have a User model and I've created an organization model. I User should have the ability to create a new Organization and edit the organization

I've added an organization_id to my Users table so that once the Organization is created I can find it through the $this->hasOne method in my Model.

The organization model in turn has a method that returned all the users that are part of the organization by calling $this->belongsToMany()

In my Nova resource for the User I would like to use the HasOne field in order to show the organization the user is part of and if they are not part of one they can Create an organization.

When I add the HasOne field to my User nova resource and go to the details view I get the following error.

Undefined column: 7 ERROR: column organizations.user_id does not exist

I do not think I need a user_id column in the organizations table because of I want more than one user to belong to the organization?

Dec
23
3 months ago
Activity icon

Replied to After Setting An Api Token For A User Why Is $user->tokens() Empty?

Still some refactoring to do but this is what I had to do to get logout from a SPA working.

public function login(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'email' => 'required|email',
            'password' => 'required'
        ]);

        if($validator->fails())
        {
            return response()->json(['status_code' => 400, 'message' => 'Bad Request']);
        }

        $credentials = request(['email', 'password']);

        if(!Auth::attempt($credentials))
        {
            return responce()->json([
                'status_code' => 500,
                'message' => 'Unauthorized'
            ]);
        }

        $user = User::where('email', $request->email)->first();
        $tokenResult = $user->createToken('authToken')->plainTextToken;
        $user->save();

        return response()->json([
            'status_code' => 200,
            'token' => $tokenResult
        ]);

    }

    public function logout(Request $request)
    {
        $user = User::where('email', $request->email)->first();
        $bt = $request->bearerToken();

        if(!$bt) return response()->json([
            'status_code' => 400,
            'message' => 'We could not locate the proper info in order to logout this user'
        ]);

        $split_string = explode("|", $bt);
        $token_id = (int)$split_string[0];

        $personal_token_object = DB::table('personal_access_tokens')->where('id', $token_id)->first();


        if($user && $bt && $personal_token_object) {

            if(($personal_token_object->tokenable_id == $user->id) && ($personal_token_object->id == $token_id))
            {
                $personal_token_object = DB::table('personal_access_tokens')->delete($token_id);
            }
        }
        else
        {
            return response()->json([
                'status_code' => 400,
                'message' => 'We could not locate the proper info in order to logout this user'
            ]);
        }

        if($personal_token_object)
        {
            return response()->json([
                'status_code' => 200,
                'message' => 'Logged out successfully'
            ]);
        }
        else
        {
            return response()->json([
                'status_code' => 400,
                'message' => 'We could not locate the proper info in order to logout this user'
            ]);
        }

    }

if there is a better way or you happen to figure you what I'm missing in order to be able to just call delete on the tokens() method on the user object, I'll see if I can refactor and get it working that way.

Activity icon

Replied to After Setting An Api Token For A User Why Is $user->tokens() Empty?

I changed my method to this for testing to see what I get back in the array and it's still empty after doing the following.

$user = User::where('email', $request->email)->first();
        $bt = $request->bearerToken();

        return response()->json([
            'bt' => $user->tokens()->where('name', 'authToken')
        ]);

My DB table is called personal_access_tokens and looks like this

https://drive.google.com/file/d/11NWeETJC4rplZTnWArnap3q8rAYMj6d_/view?usp=sharing

Activity icon

Replied to After Setting An Api Token For A User Why Is $user->tokens() Empty?

I still get an empty array. I'm wondering if this has anything to do with using Nova and how it's auth system works?

Dec
22
3 months ago
Activity icon

Started a new Conversation After Setting An Api Token For A User Why Is $user->tokens() Empty?

My Laravel 8 application has an REST Api for other applications to login and logout with. I'm able to log a user in successfully and send back a token to put in the headers for all requests that require an auth token.

The problem I'm having right now is logging the user out. I have a method for logging out that has the following line of code.

I'm trying to use the Sanctum tokens. I do see that the personal_access_tokens table is populated. I'm just not sure why my User tokens array is empty.

$user->tokens()

I've looked at the array that comes back when calling this and it is empty. I'm not sure where my tokens are being stored or how to delete them. In theory I should be able to call $user->tokens()->delete() but like I said, there are not tokens to be found after I look up the user in the DB.

here is my current logout code.

public function logout(Request $request)
    {
        $user = User::where('email', $request->email)->first();
        $bt = $request->bearerToken();

//        return response()->json([
//            'bt' => $user->tokens()
//        ]);

///I'd like to check to see if the bearerToken in header matches before deleting
///not sure if ->where('id') is the right way to find if the tokens match
        if($user) {
            if($user->tokens()->where('id', $bt) == $bt)
            {
                $user->tokens()->where('id', $bt)->delete();
            }
        }
        else
        {
            return response()->json([
                'status_code' => 400,
                'message' => 'We could not locate the proper info in order to logout this user'
            ]);
        }


        $request->user()->currentAccessToken()->delete();
        return response()->json([
            'status_code' => 200,
            'message' => 'Logged out successfully'
        ]);
    }

Dec
14
3 months ago
Activity icon

Started a new Conversation Tailwindcss SCSS Error @apply Class Does Not Exist Issue

I recently upgraded to tailwind 2 and I made sure to follow the upgrade guide for laravel. I'm using SCSS in my project and all of the .scss files that I use the tailwind @apply in throw the following error.

For example:

ERROR in ./resources/assets/sass/app.scss (./node_modules/css-loader??ref--4-2!./node_modules/postcss-loader/src??postcss0!./node_modules/sass-loader/dist/cjs.js??ref--4-4!./resources/assets/sass/app.scss)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
SyntaxError

(277:10) The `.bg-gray-400` class does not exist, but `bg-gray-400` does. If you're sure that `.bg-gray-400` exists, make sure that any `@import` statements are being properly processed before Tailwind CSS sees your CSS, as `@apply` can only be used for classes in the same CSS tree.

  275 | 
  276 | .video-container {
> 277 |   @apply .bg-gray-400 .relative .w-full .h-0 .shadow;
      |          ^
  278 |   border: gray solid;
  279 |   padding-bottom: 42.25%;

The Tailwind classes work if I use them inline in the elements class=""

My main app.scss has the following import statements in it so I'm not sure what's wrong.

//tailwind
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
Dec
08
4 months ago
Activity icon

Started a new Conversation Nova Error On Heroku - Please Install Intl Extension

I'm running a laravel app on heroku that is using Nova. I've gotten in deployed and everything seemed to work however I have a Product model that has a "price" field. The error message that I'm getting seems to suggest that there is an issue with the NumberFormatter::setAttribute() function in Symfony.

The error I receive when trying to render the main list of Product models is the following.

The Symfony\Component\Intl\NumberFormatter\NumberFormatter::setAttribute() method's argument $attr value 2 behavior is not implemented. The available attributes are: FRACTION_DIGITS, GROUPING_USED, ROUNDING_MODE. Please install the "into" extension for full localization capabilities"

Has anyone run into this error and what would solve it. I'm using niginx on heroku.

My Procfile is this.

web: vendor/bin/heroku-php-nginx -C nginx_app.conf /public

and my nginx_app.conf has this in it.

location / {
    # try to serve file directly, fallback to rewrite
    try_files $uri @rewriteapp;
}

location @rewriteapp {
    # rewrite all to app.php
    rewrite ^(.*)$ /index.php/ last;
}

location ~ ^/(app|app_dev|config)\.php(/|$) {
    try_files @heroku-fcgi @heroku-fcgi;
    internal;
}
Activity icon

Replied to Heroku Deploy Fails Because Of Moontoast Math And Nova

I was actually able to solve this problem by going into the ./nova composer.json file and updating the moontoast/math package to this.

"moontoast/math": "1.1.2 as 1.99.0",

Activity icon

Started a new Conversation Heroku Deploy Fails Because Of Moontoast Math And Nova

I have a laravel 8 application that is also using Nova. I would like to deploy to Heroku. When heroku tries to build I get the follow error about using to man PHP versions ?

Has anyone run into a similar issue and if so, how should I solve this?

 !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
			Detected buildpacks: PHP,Node.js
			See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
 !     ERROR: Failed to install system packages!
 !     
 !     Your platform requirements (for runtimes and extensions) could
 !     not be resolved to an installable set of dependencies, or a
 !     platform package repository was unreachable.
 !     
 !     This usually means that you (or packages you are using) depend
 !     on a combination of PHP versions and/or extensions that are
 !     currently not available on Heroku.
 !     
 !     The following is the full output from the installation attempt:
 !     
 !     > Loading repositories with available runtimes and extensions
 !     > Updating dependencies
 !     > Your requirements could not be resolved to an installable set of packages.
 !     > 
 !     >   Problem 1
 !     >     - Installation request for phpseclib/bcmath_compat 1.0.5 -> satisfiable by phpseclib/bcmath_compat[1.0.5].
 !     >     - phpseclib/phpseclib 2.0.29 requires php >=5.3.3 -> satisfiable by php[7.1.33, 7.2.26, 7.2.27, 7.2.28, 7.2.29, 7.2.30, 7.2.31, 7.2.32, 7.2.33, 7.2.34, 7.3.13, 7.3.14, 7.3.15, 7.3.16, 7.3.17, 7.3.18, 7.3.19, 7.3.20, 7.3.21, 7.3.22, 7.3.23, 7.3.24, 7.3.25, 7.4.10, 7.4.11, 7.4.12, 7.4.13, 7.4.2, 7.4.3, 7.4.4, 7.4.5, 7.4.6, 7.4.7, 7.4.8, 7.4.9, 8.0.0].
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.13
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.14
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.15
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.16
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.17
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.18
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.19
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.20
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.21
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.22
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.23
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.24
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.3.25
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.10
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.11
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.12
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.13
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.2
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.3
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.4
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.5
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.6
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.7
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.8
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.4.9
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 8.0.0
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.1.33
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.2.26
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.2.27
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.2.28
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.2.29
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.2.30
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.2.31
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.2.32
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.2.33
 !     >     - don't install phpseclib/bcmath_compat 1.0.5|don't install php 7.2.34
 !     >     - Installation request for phpseclib/phpseclib 2.0.29 -> satisfiable by phpseclib/phpseclib[2.0.29].
 !     > 
 !     > Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
 !     
 !     For reference, the following runtimes are currently available:
 !     
 !     PHP:  8.0.0, 7.4.13, 7.4.12, 7.4.11, 7.4.10, 7.4.9, 7.4.8, 
 !     7.4.7, 7.4.6, 7.4.5, 7.4.4, 7.4.3, 7.4.2, 7.3.25, 7.3.24, 
 !     7.3.23, 7.3.22, 7.3.21, 7.3.20, 7.3.19, 7.3.18, 7.3.17, 
 !     7.3.16, 7.3.15, 7.3.14, 7.3.13, 7.2.34, 7.2.33, 7.2.32, 
 !     7.2.31, 7.2.30, 7.2.29, 7.2.28, 7.2.27, 7.2.26, 7.1.33
 !     HHVM: 
 !     
 !     Please verify that all requirements for runtime versions in
 !     'composer.lock' are compatible with the list above, and ensure
 !     all required extensions are available for the desired runtimes.
 !     
 !     When choosing a PHP runtimes and extensions, please also ensure
 !     they are available on your app's stack (heroku-18), and select
 !     a different stack if needed after consulting the article below.
 !     
 !     For a list of supported runtimes & extensions on Heroku, please
 !     refer to: https://devcenter.heroku.com/articles/php-support
 !     Push rejected, failed to compile PHP app.
 !     Push failed
Dec
04
4 months ago
Activity icon

Started a new Conversation Can I Authenticate With Sanctum Using Another Laravel Backend Instead Of A SPA?

I have two laravel applications. One is going to be an Admin application that will control all the content for several subdomain apps that I'm creating with another Laravel app that will basically be an e-commerce application.

I'm using Laravel 8 and I've implemented Sanctum because it's part of the Laravel Jestream Auth system.

My Laravel Ecommerce application will be making REST calls to my CMS to get product data and eventually to submit orders from customers.

I'd like to be able to register and login users via the API and keep all the users in the same CMS / Admin tool that I'm building.

How should I go about doing this? I need recommendations on how to log in from a Laravel Controller and then store the CRF Token in a browser cookie so I can manage the user login and logout.

Basically, once the user is logged in to one subdomain I'd like for them to be logged into all subdomains.

Dec
02
4 months ago
Activity icon

Replied to How Do I Set S3 Public Access On A File Upload Using Nova

What I would really like to be able to do from Nova is to allow the user to set an asset from public to private from the admin interface.

Activity icon

Replied to How Do I Set S3 Public Access On A File Upload Using Nova

Thanks. I actually watched that in order to get my uploads working and what I've ended up doing is adding the config to set everything public to my filesystems.php.

's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
            'visibility' => 'public'
        ],
Dec
01
4 months ago
Activity icon

Started a new Conversation How Do I Set S3 Public Access On A File Upload Using Nova

I'm creating a MediaAsset model so that users of the Nova admin can attach images, 3d assets, pdfs, and whatever else they would like to a Product model.

I have my application set up so that Nova can upload to S3 and that works fine. What I can't figure out how to do is make sure that once the file is uploaded to S3 I need to set access to the file to the public so my Single Page app can pull in the asset and display things like image files or if it's a PDF the user will need to be able to click and download the file directly from S3.

By default, all these files are set to private when uploaded.

Here is what my fields section looks like in my Resource for MediaAsset model.

return [
            ID::make('id')->sortable()->hideFromDetail(),
            File::make('Media Asset', 'url')
                ->disk('s3')->prunable()
                ->storeOriginalName('filename')
                ->path('asset')->hideFromDetail(),
            Text::make('File Name', 'filename')->showOnDetail()->hideWhenCreating()->hideWhenUpdating(),
            Text::make('URL', 'url')->showOnDetail()->hideWhenCreating()->hideWhenUpdating(),
            BelongsTo::make('Product'),
        ];
Nov
29
4 months ago
Activity icon

Replied to Making API Calls From One Laravel App To Another

Thanks, That solved the issue. What kind of issues might I run into once I deploy this to production? what do I need to look out for once I'm making calls between applications using https?

Nov
26
4 months ago
Activity icon

Started a new Conversation Making API Calls From One Laravel App To Another

I'm building 4 e-commerce sites for a client. These 4 sites will use the same code base and be deployed as separate applications. I'm then setting up a CMS that is using Nova to manage all the product data, users and orders from all the sites.

The CMS's database will be the single source of truth for all data across all the ecom apps. My approach will be that the CMS will expose an API for products to be listed on the ecomm sites by requesting a list of products via an API call to the CMS application.

I have a basic product function and route setup that looks something like this.

Route::get('products/{domain}', [ProductsController::class, 'getProductsByDomain']);

In my e-commerce controller, I'm trying to do something like this.

$products = Http::get('http://ecomm-admin.test/api/products/avid');

 return view('products')->with('products', $products);

Both apps are hosted locally right now using Valet and I'm getting the following error from my e-commerce application when trying to retrieve the products from the API call.

Illuminate \ Http \ Client \ ConnectionException
cURL error 6: Could not resolve:ecomm-admin.test (Domain name not found) (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://ecomm-admin.test/api/products/avid
Previous exceptions
cURL error 6: Could not resolve: ecomm-admin.test (Domain name not found) (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://ecomm-admin.test/api/products/avid (0)