stargatesg1

stargatesg1

Member Since 4 Years Ago

Experience Points 7,105
Experience Level 2

2,895 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 18
Lessons
Completed
Best Reply Awards 0
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.

12 Sep
4 days ago

stargatesg1 left a reply on Updating Credit Card Laravel Cashier

That I know but I am confused as to where is the form I build to enter the credit card in. I just need to see a example with a from where the user enters the credit card

11 Sep
5 days ago

stargatesg1 started a new conversation Updating Credit Card Laravel Cashier

I am still puzzled on how to update a credit card. The reason I haven't found a example form to do this.

09 Sep
1 week ago

stargatesg1 left a reply on Cors In Lumen 5.8

This is what I have so far

app\Http\Middleware\CorsMiddleware.php

<?php
namespace App\Http\Middleware;

use Closure;

class CorsMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $headers = [
            'Access-Control-Allow-Origin'      => '*',
            'Access-Control-Allow-Methods'     => 'POST, GET, OPTIONS, PUT, DELETE',
            'Access-Control-Allow-Credentials' => 'true',
            'Access-Control-Max-Age'           => '86400',
            'Access-Control-Allow-Headers'     => 'Content-Type, Authorization, X-Requested-With'
        ];

        if ($request->isMethod('OPTIONS'))
        {
            return response()->json('{"method":"OPTIONS"}', 200, $headers);
        }

        $response = $next($request);
        foreach($headers as $key => $value)
        {
            $response->header($key, $value);
        }

        return $response;
    }
}

In this file I have this

bootstrap/app.php

$app->middleware([
    App\Http\Middleware\CorsMiddleware::class
 ]);

I am not sure what I am missing

08 Sep
1 week ago

stargatesg1 started a new conversation Cors In Lumen 5.8

I followed this tutorial but I an still getting CORS issues. Here is a link to the tutorial

https://www.codementor.io/chiemelachinedum/steps-to-enable-cors-on-a-lumen-api-backend-e5a0s1ecx

I am calling the following route via AJAX

Here is the Route

$router->post('/api/customer', '[email protected]');
06 Sep
1 week ago

stargatesg1 left a reply on Laravel Cashier Lumen

Correct vendor:publish its mostly the migration files we need right?

stargatesg1 started a new conversation Laravel Cashier Lumen

I can install the library within lumen but when I run

php artisan vendor:publish --tag="cashier-migrations"

It doesn't work is there some alternative way to install Cashier for Lumen

stargatesg1 left a reply on Lumen New Generates Errors

But I didn't install composer using sudo. I did using brew.

stargatesg1 left a reply on Lumen New Generates Errors

this works with sudo. sudo lumen new myapp

stargatesg1 left a reply on Lumen New Generates Errors

I am using brew to install composer its all up to date :)

stargatesg1 left a reply on Lumen New Generates Errors

I did but I got this error

composer update laravel/lumen-installer Composer could not find a composer.json file in /Users/user To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

stargatesg1 left a reply on Lumen New Generates Errors

This happens when i am creating a brand new project by running lumen new

05 Sep
1 week ago

stargatesg1 started a new conversation Lumen New Generates Errors

When running the following lumen new myapp it generates the following error

[ErrorException]
  copy(/Users/kev/.composer/cache/files/symfony/translation/75fd13ef
  af4faa967e42f12e2b942e2f14155a29.zip): failed to open stream: Permission
   denied
03 Jun
1 year ago

stargatesg1 left a reply on Api Project Structure

I agree I think Lumen is a step up for Microservices. Microservices is hard for just once person. Deployment is tough. Thanks for all the help

02 Jun
1 year ago

stargatesg1 left a reply on Api Project Structure

Thanks for the help.

it would be

mydomain.com/api/users

where is /api is all Lumen. But suppose that you want to hot swap frameworks so that /api/users is Lumen but /api/orders is NodeJS

stargatesg1 started a new conversation Api Project Structure

Lets say I have a simple e-commerce platform. I am trying to figure out how to structure my Lumen API

Cart API User API Orders api

Now does Lumen need a separate instance for each api

for instance the API's will be broken down like this.

users.mydomain.com orders.mydomain.com cart.mydomain.com

I just need some direction guidance.

27 May
1 year ago

stargatesg1 started a new conversation Notifications

If I want to use Notifications in Lumen just like in Laravel how do I do it.

23 May
1 year ago

stargatesg1 left a reply on Microservices Architecture For Laravel.

My only concern is performance. Can Laravel scale to a larger application with multiple users.

stargatesg1 started a new conversation Microservices Architecture For Laravel.

Is it possible to use Laravel in a Microservices Architecture? Would it be better to use Lumen. I find that the development of Lumen is very focused and slow.

stargatesg1 left a reply on Stripe For Lumen

Thanks for the information

21 May
1 year ago

stargatesg1 started a new conversation Stripe For Lumen

Is it easy to integrate Stripe with Lumen.

26 Apr
1 year ago

stargatesg1 started a new conversation Mailtrap Email Error

For some reason when sending a email on my local machine. I am getting the following error

POSTXHRhttp://www.devqi.com/api/workshop[HTTP/1.1 500 Internal Server Error 2182ms] 
HeadersCookiesParamsResponseTimingsStack TraceJSONstatuserrorexceptionSwift_TransportExceptioncodeSystemErrormsgfile/www/restoredqi/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.phpline268Response payload 1{"status":"error","exception":"Swift_TransportException","code":"SystemError","msg":"Connection could not be established with host smtp.mailtrap.io [Unable to find the socket transport \"plain\" - did you forget to enable it when you configured PHP? #1]","file":"\/www\/restoredqi\/vendor\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/StreamBuffer.php","line":268}

Any ideas as to why.

05 Apr
1 year ago

stargatesg1 left a reply on Sending Emails To A User That Isn't Logged In

I am using mailtrap on my local machine to test

stargatesg1 left a reply on Sending Emails To A User That Isn't Logged In

Thanks for the help still got the same error

Connection could not be established with host smtp.mailtrap.io [Unable to find the socket transport "plain" did you forget to enable it when you configured PHP? #]
04 Apr
1 year ago

stargatesg1 left a reply on Sending Emails To A User That Isn't Logged In

Thanks for all the help. I got the message going now have to fix this error in the console. I am still using Laravel 5.4

Here is my error mailtrap was working before but not sure why it isn't now

POSTXHRhttp://www.devqi.com/api/workshop[HTTP/1.1 500 Internal Server Error 2163ms] 
HeadersCookiesParamsResponseTimingsStack TraceJSONstatuserrorexceptionSwift_TransportExceptioncodeSystemErrormsgfile/www/restoredqi/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.phpline268Response payload 1{"status":"error","exception":"Swift_TransportException","code":"SystemError","msg":"Connection could not be established with host mailtrap.io [Unable to find the socket transport \"plain\" - did you forget to enable it when you configured PHP? #1]","file":"\/www\/restr\/vendor\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/StreamBuffer.php","line":268}

stargatesg1 left a reply on Sending Emails To A User That Isn't Logged In

Just a simple email. There is no user account associated with this address. I just like how the notification emails are done very simple. But I agree with you in Laravel has made it so complicated to send a simple email.

The simple email would just be the same as a notification template

stargatesg1 left a reply on Sending Emails To A User That Isn't Logged In

The thing is I just want to send a email. The user doesn't even exist in the database and never will. So just need a easy to send a email to a user.

03 Apr
1 year ago

stargatesg1 started a new conversation Sending Emails To A User That Isn't Logged In

I was wondering if Laravel how can I send a email to a user that isn't logged in. Lets say they are registering for a workshop but doens't need a account.

Here is the code I have now but doesn't seem to be working

  $user = new User();
        $User->email='[email protected]';

        /*Send email to user */
        $user->notify(new workshop());
23 Aug
2 years ago

stargatesg1 left a reply on Return Response As JSON

This worked Thanks for the help

Route::get('/tasks/{task}', function($id) {

  $tasks=DB::table('tasks')->find($id);

    return response()->json($tasks);

});

22 Aug
2 years ago

stargatesg1 started a new conversation Return Response As JSON

I am trying to return this data as JSON but I can't remember how to do it here is the code


Route::get('/tasks/{task}', function($id) {

  $tasks=DB::table('tasks')->find($id);

  return $tasks;

});
05 Aug
2 years ago

stargatesg1 left a reply on Having Permission Issues With Upload Files And Deleting

I am using OSX 10.12.6 most of the examples are in Ubuntu

I tired

sudo chmod -R 777 storage

also I tired this

sudo chown -R _www:_www storage

But didn't work also

stargatesg1 started a new conversation Having Permission Issues With Upload Files And Deleting

I am hainving the following issues when use

Storage::delete() 

I get the following error

Operation not permitted

I am using apache on OSX 10.12.6

I am not sure what would be the directory permisions for app/storage and the sub directories and files are

03 Aug
2 years ago

stargatesg1 started a new conversation Laravel Mix Configuration

This is a combination of vue and laravel mix. If I have lazy loading routes the issue is that Laravel Mix doesn't put any new lazy loaded routes in a folder with the corresponding javascript file

Here is my mix file. So lets say if I add another lazy load folder how do I configure it in here. For now I ihave steps but i want to add stepsadmin.

let mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */


mix.webpackConfig({
    output: {
        publicPath: "/steps",
        chunkFilename: '[name].js'
    },
});


mix.js('resources/assets/js/app.js', 'public/js', {
    includePaths: ['steps','stepsadmin']
});


mix.sass('resources/assets/sass/app.scss', 'public/css', {
    includePaths: ['node_modules']
});


19 Jul
2 years ago

stargatesg1 started a new conversation Issue With Laravel Mixer With SCSS Path From Node Modules

I am using material.io and when including scss from node_modules directory Laravel mixer doesn't compile. I need to include the node path for scss processing. Here has to be a way to include paths like. I should be able to compile the SCSS files with no issue.

includePaths: ['node_modules']

here is my webpack.mix.js file

let mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');


mix.webpackConfig({

});

stargatesg1 left a reply on Getting The Following Error This Dependency Was Not Found: FS

I figured out what the issue was. The cause was I was loading vue-loader in the app.js file. Its fixed now. Thanks for the help. Late night coding wasn't thinking.

18 Jul
2 years ago

stargatesg1 started a new conversation Getting The Following Error This Dependency Was Not Found: FS

When I run npm run dev. I am getting the following error

ERROR Failed to compile with 3 errors 22:07:39

This dependency was not found:

  • fs in ./node_modules/vue-loader/lib/utils/normalize.js, ./node_modules/resolve/lib/sync.js and 1 other

To install it, you can run: npm install --save fs

Here is a copy of my configuration file.

I am using Laravel 5.4

let mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');


mix.webpackConfig({

});

Here is my Package.json file

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "bin": {
    "cross-env": "dist/bin/cross-env.js"
  },
  "devDependencies": {
    "@websanova/vue-auth": "^2.13.0-beta",
    "axios": "^0.16.2",
    "babel": "^6.23.0",
    "babel-core": "^6.25.0",
    "babel-loader": "^7.1.1",
    "babel-plugin-transform-es2015-spread": "^6.22.0",
    "babel-preset-env": "^1.6.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.0.1",
    "css-loader": "^0.28.4",
    "eslint": "^3.19.0",
    "eslint-config-standard": "^10.2.1",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^1.7.1",
    "eslint-plugin-html": "^2.0.0",
    "eslint-plugin-import": "^2.3.0",
    "eslint-plugin-node": "^4.2.2",
    "eslint-plugin-promise": "^3.4.0",
    "eslint-plugin-standard": "^3.0.1",
    "file-loader": "^0.11.1",
    "friendly-errors-webpack-plugin": "^1.1.3",
    "jquery": "^3.1.1",
    "laravel-mix": "^1.0",
    "lodash": "^4.17.4",
    "material-components-web": "^0.15.0",
    "material-design-icons": "^3.0.1",
    "normalize-scss": "^7.0.0",
    "path": "^0.12.7",
    "url-loader": "^0.5.8",
    "vue": "^2.4.1",
    "fs": "0.0.1-security",
    "vue-loader": "^12.2.2",
    "vue-mdc-adapter": "0.0.17",
    "vue-progressbar": "^0.7.2",
    "vue-resource": "^1.3.4",
    "vue-router": "^2.7.0",
    "webpack": "^3.2.0",
    "async": "^2.5.0",
    "normalize": "^0.3.1"
  },
  "dependencies": {

  }
}

01 Jun
2 years ago

stargatesg1 left a reply on Would Be Nice If We Had This In Laravel.

Yep they compress the files like Pied Piper. Its pretty cool cheap and blazing fast.

stargatesg1 started a new conversation Would Be Nice If We Had This In Laravel.

Take a look at this Amazing way to store files. Its the same thing as Pied Piper from Silicon Valley

https://storj.io/index.html

21 May
2 years ago

stargatesg1 left a reply on Invalid Token For Email Password Reset

Thanks for all the help yep it does. Here is the error I get

{"response":{"headers":{},"original":{"message":"This password reset token is invalid."},"exception":null}}

stargatesg1 left a reply on Invalid Token For Email Password Reset

So if i test it within a form without postman it also returns invalid email token

stargatesg1 left a reply on Invalid Token For Email Password Reset

Don't think so it's the token assigned to the forgot password email.

When testing in postman i don't need a csfr token

stargatesg1 left a reply on Invalid Token For Email Password Reset

All the routes are correct. I am just testing this in postman. When I request for a new password I get a new token and then i use that token. I can't reset the password at this point because it says invalid token

stargatesg1 started a new conversation Invalid Token For Email Password Reset

I am not sure why I am getting a invalid token for password reset. I requested a reset password and the token gets inserted into the database but when I test that token using postman it comes up as invalid. Here is the custom code I basically took some of the code from

Illuminate\Foundation\Auth\ResetsPasswords

Here is the code

<?php

namespace App\Http\Controllers\Api;


namespace App\Http\Controllers\Api;
use Illuminate\Http\Request;
use Illuminate\Contracts\Auth\PasswordBroker;
use Response;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Password;

//Trait
use Illuminate\Foundation\Auth\ResetsPasswords;

class ResetPassController extends Controller
{

    use ResetsPasswords;


    /**
     * Reset the given user's password.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function resetpass(Request $request)
    {
        $respond=$this->reset($request);

        return response([
            'response' => $respond
        ]);
    }


    public function rules()
    {
        return [
            'token' => 'required',
            'email' => 'required|email',
            'password' => 'required|confirmed|min:6',
        ];
    }


    public function reset(Request $request)
    {
        //$this->validate($request, $this->rules(), $this->validationErrorMessages());

        // Here we will attempt to reset the user's password. If it is successful we
        // will update the password on an actual user model and persist it to the
        // database. Otherwise we will parse the error and return the response.
        $response = $this->broker()->reset(
            $this->credentials($request), function ($user, $password) {
            $this->resetPassword($user, $password);
        }
        );

        // If the password was successfully reset, we will redirect the user back to
        // the application's home authenticated view. If there is an error we can
        // redirect them back to where they came from with their error message.
        $response == Password::PASSWORD_RESET
            ? $this->sendResetResponse($response)
            : $this->sendResetFailedResponse($request, $response);
        return response(['message' => trans($response)]);

    }

    public function resetPassword($user, $password)
    {
        $user->forceFill([
            'password' => bcrypt($password),
            'remember_token' => Str::random(60),
        ])->save();

    }


    public function credentials(Request $request)
    {
        return $request->only(
            'email', 'password', 'password_confirmation', 'token'
        );
    }

}

06 Apr
2 years ago

stargatesg1 started a new conversation Selecting Date Field

I am having problems selecting a date field. Lets say created_at has the value of

"created_at": "2017-04-01 14:27:36" I want to write a Eloquent statement like this

        $getCurrent=$Usage->where([
            ['track_id', '=', 16],
            ['user_id', '=', 1],
            ['created_at', '=', date('Y-m-d')]
        ])->get();

So in the created_at it will select the current date minus the time.

14 Mar
2 years ago

stargatesg1 left a reply on Enable Hotlinking

Thanks for the help. I tried that and it didn't work I can still access my images form jsfiddle. Here is the updated configuration.

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/mydomain.com/before/*;

server {
    listen 80;
    listen [::]:80;
    server_name mydomain.com;
    root /home/forge/mydomain.com/public;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers '';
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DOT NOT REMOVE!)
    include forge-conf/mydomain.com/server/*;

   location / {
       try_files $uri $uri/ /index.php?$query_string;
}
    
    
    

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

    access_log off;
    error_log  /var/log/nginx/mydomain.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
    
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }
    


location ~ .(gif|png|jpe?g)$ {
    valid_referers blocked mydomain.com www.mydomain.com;
    if ($invalid_referer) {
        return 403;
    }
}




## Deny certain Referers (case insensitive)
    ## The ~* makes it case insensitive as opposed to just a ~
 if ($http_referer ~* (babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversoftware|sex|teen|video|webcam|zippo))
    {  return 403;   }
    



location ~ /\.ht {
    deny all;
}



}

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/mydomain.com/after/*;

stargatesg1 left a reply on Enable Hotlinking

Can anybody shine some light on this?

09 Mar
2 years ago

stargatesg1 started a new conversation Enable Hotlinking

In my nginx configuration I am having trouble enabling hotlinking protection. I don't want other sites accessing images from my server. Here is my configuration file. I am not sure what i am doing wrong.

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/mydomain.com/before/*;

server {
    listen 80;
    listen [::]:80;
    server_name mydomain.com;
    root /home/forge/mydomain.com/public;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
       ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DOT NOT REMOVE!)
    include forge-conf/mydomain.com/server/*;

   location / {
       try_files $uri $uri/ /index.php?$query_string;
}
    
    
    

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

    access_log off;
    error_log  /var/log/nginx/mydomain.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
    
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }
    
    #Prevent hotlinking
location ~* (\.jpg|\.png|\.css|\.mp3)$ {
    valid_referers blocked mydomain.com www.mydomain.com;
    if ($invalid_referer) {
        return 444;
    }
}


    location ~ /\.ht {
        deny all;
    }
}

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/mydomain.com/after/*;

18 Feb
2 years ago

stargatesg1 started a new conversation Trial For Different Subscriptions

In Laravel Cashier how do you set up trials for different packages.

Let's say package one costs $9.99

and package two

10.99

how can i set trial options for different packages is it built in Laravel

15 Feb
2 years ago

stargatesg1 started a new conversation 500 Internal Server Error On Forge Using Ngingx

I am having a issue. On my local apache machine everything works the token returns the error codes with no problem and returns the proper headers. On the live machine I get a 500 internal server error. Here is the issue on github can't seem to solve it

https://github.com/tymondesigns/jwt-auth/issues/1006

There is also a log as to what is happening on the server.

stargatesg1 left a reply on Exception Error

Thanks that fixed the issue

14 Feb
2 years ago

stargatesg1 started a new conversation Exception Error

I am getting the following error. I am still using Laravel 5.3. Not sure what I am missing here.

{"status":"error","exception":"ErrorException","code":"SystemError","msg":"Declaration of App\\Providers\\EventServiceProvider::boot(Illuminate\\Contracts\\Events\\Dispatcher $events) should be compatible with Illuminate\\Foundation\\Support\\Providers\\EventServiceProvider::boot()","file":"\/www\/restoredqi\/app\/Providers\/EventServiceProvider.php","line":11}

EventServiceProvider.php

<?php

namespace App\Providers;

use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        'App\Events\SomeEvent' => [
            'App\Listeners\EventListener',
        ],
    ];

    /**
     * Register any events for your application.
     *
     * @return void
     */
    public function boot(DispatcherContract $events)
    {
        parent::boot($events);


        // fired when the token could not be found in the request
        Event::listen('tymon.jwt.absent', function () {
            throw new \App\Exceptions\JWTAbsentException;
        });

        // fired when the token has expired
        Event::listen('tymon.jwt.expired', function () {
            throw new \App\Exceptions\JWTExpiredException;
        });

        // fired when the token is found to be invalid
        Event::listen('tymon.jwt.invalid', function () {
            throw new \App\Exceptions\JWTInvalidException;
        });

        // fired if the user could not be found (shouldn't really happen)
        Event::listen('tymon.jwt.user_not_found', function () {
            throw new \App\Exceptions\JWTUserNotFoundException;
        });
    }
}

Handler.php

<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;



class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that should not be reported.
     *
     * @var array
     */
    protected $dontReport = [
        AuthorizationException::class,
        HttpException::class,
        ModelNotFoundException::class,
        ValidationException::class,
    ];

    /**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param  \Exception  $exception
     * @return void
     */
    public function report(Exception $exception)
    {
        parent::report($exception);
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $exception
     * @return \Illuminate\Http\Response
     */
    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $e
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $e)
    {
        if ($e instanceof HttpResponseException) {
            return $e->getResponse();
        }

        $class = get_class($e);

        switch($class) {
            case 'Illuminate\\Http\\Exception\\HttpResponseException':
                return parent::render($request, $e);
                break;
            case 'Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException':
                $code = 'NotFound';
                $msg = 'Not Found.';
                $statusCode = 404;
                break;
            case 'Illuminate\Database\Eloquent\ModelNotFoundException':
                $code = 'ModelNotFound';
                $model = str_replace('App\\Models\\', '', $e->getModel());
                $msg = $model . ' not found.';
                $statusCode = 404;
                break;
            case 'Illuminate\Auth\Access\AuthorizationException':
                $code = 'InvalidCredentials';
                $msg = 'Credentials are invalid.';
                $statusCode = 400;
                break;
            case 'Tymon\JWTAuth\Exceptions\JWTException';
                $code = 'JWTException';
                $msg = 'There was an issue generating jwt tokens.';
                $statusCode = 400;
                break;
            case 'App\Exceptions\JWTAbsentException';
                $code = 'TokenAbsent';
                $msg = 'The token is absent.';
                $statusCode = 400;
                break;
            case 'App\Exceptions\JWTExpiredException';
                $code = 'TokenExpired';
                $msg = 'The token has expired.';
                $statusCode = 401;
                break;
            case 'App\Exceptions\JWTInvalidException';
                $code = 'InvalidToken';
                $msg = 'The token is invalid.';
                $statusCode = 401;
                break;
            case 'App\Exceptions\JWTUserNotFoundException';
                $code = 'UserNotFound';
                $msg = 'The user token does not match.';
                $statusCode = 404;
                break;
            default:
                $code = 'SystemError';
                $msg = $e->getMessage();
                $file = $e->getFile();
                $line = $e->getLine();
                $statusCode = 500;
        }

        $data = [
            'status' => 'error',
            'exception' => $class,
            'code' => $code,
            'msg' =>  $msg
        ];

        if (isset($file)) {
            $data['file'] = $file;
        }

        if (isset($line)) {
            $data['line'] = $line;
        }

        return response($data, $statusCode)
            ->header('Access-Control-Allow-Origin', '*')
            ->header('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With')
            ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
    }

    /**
     * Convert an authentication exception into an unauthenticated response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Illuminate\Auth\AuthenticationException  $exception
     * @return \Illuminate\Http\Response
     */
    protected function unauthenticated($request, AuthenticationException $exception)
    {
        if ($request->expectsJson()) {
            return response()->json(['error' => 'Unauthenticated.'], 401);
        }

        return redirect()->guest('login');
    }
}