Randy_Johnson

Randy_Johnson

Member Since 2 Years Ago

Experience Points
6,380
Total
Experience

3,620 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
7
Lessons
Completed
Best Reply Awards
1
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.

Level 2
6,380 XP
Aug
06
3 days ago
Activity icon

Replied to Help! Problem With Composer!

Omg there was 4 different files called php.ini, turns out I changed all 3 of the wrong ones.

Thanks guys

Activity icon

Started a new Conversation Help! Problem With Composer!

Problem 1 - Installation request for league/flysystem 1.0.70 -> satisfiable by league/flysystem[1.0.70]. - league/flysystem 1.0.70 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system. Problem 2 - league/flysystem 1.0.70 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system. - laravel/framework v7.23.2 requires league/flysystem ^1.0.34 -> satisfiable by league/flysystem[1.0.70]. - Installation request for laravel/framework v7.23.2 -> satisfiable by laravel/framework[v7.23.2].

Jun
28
1 month ago
Activity icon

Replied to .env MAIL Variables Not Clearing

Thanks Snapey.

Jun
27
1 month ago
Activity icon

Started a new Conversation .env MAIL Variables Not Clearing

My original mail var are:

MAIL_MAILER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=462
MAIL_USERNAME=email
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl

Which I had a timeout problem of.

connection could not be established with host smtp.googlemail.com :stream_socket_client(): unable to connect to ssl://smtp.googlemail.com:462

So, looking through some forums I came across.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls

But when running the code again I come up with the same error of:

Connection could not be established with host smtp.googlemail.com :stream_socket_client(): unable to connect to ssl://smtp.googlemail.com:462

Which is saying to me that there is a problem with the env. vars not resetting, even though I ran.

php artisan cache:clear
Jun
18
1 month ago
Activity icon

Replied to Is Javascript Better Than PHP

If you want to build a website, use a framework, Laravel is a good choice.

Jun
10
1 month ago
Activity icon

Awarded Best Reply on CSS Help!

Fixed

        <div class="h-25">
          <p><strong>Shifting Parameters (m)</strong></p>
        </div>

Activity icon

Replied to CSS Help!

Fixed

        <div class="h-25">
          <p><strong>Shifting Parameters (m)</strong></p>
        </div>

Activity icon

Started a new Conversation CSS Help!

https://ibb.co/vYk4wct

I want the input columns to all be on the same level, I've tried margin and padding but it is wrong. I am using bootstrap as well, if anyone knows the answer in that format.

Thank you in advanced.

<div class="row mt-4">
      <div class="col-lg-3 col-md-6 col-sm-12">
        <p><strong>Ellipsoial Cartesian Coordinates (m)</strong></p>
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
      </div>
      <div class="col-lg-3 col-md-6 col-sm-12">
        <p><strong>Conventional Terrestrial Coordinates (m)</strong></p>
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
      </div>
      <div class="col-lg-3 col-md-6 col-sm-12">
        <p><strong>Shifting Parameters (m)</strong></p>
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
      </div>
      <div class="col-lg-3 col-md-6 col-sm-12">
        <p><strong>Rotation Parameters (second)</strong></p>
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
        <label for="exampleForm2">X Pole (Second)</label>
        <input type="text" id="exampleForm2" class="form-control">
      </div>
    </div>
Jun
02
2 months ago
Activity icon

Started a new Conversation Failed To Open Stream - Just Uploaded Website Online

Hey, I have made a website before and when I extract the public everything works.

But with my newly uploaded website I am getting this error even though I followed the same steps.

file_put_contents(C:\Users\Josh\Desktop\Files\websites\T-Tobacco\TTobacco - local\storage\framework/sessions/ov9WFVcxQJXoTzRZRA1TmaOF6Y23XcBQwx7skDdi): failed to open stream: No such file or directory

My file layout is

website

	public html				<--- public folder is in here directing to website contents.

	website contents
May
20
2 months ago
Activity icon

Started a new Conversation Request $request OR Request()

Why am I using

$request->input('my_input');

when I can use

request('my_input')
May
19
2 months ago
Activity icon

Replied to Undefined Variable When Passing Data To A Function Or Method

Maybe something like this. I made the input a global so it is seen over the whole class, so there is no need to pass it as a parameter.

You may have to take a good look for any mistakes, since I am not on the IDE.

class SomeClass {

private $input = [];

function someFunction(Request $request)
{
	$this->input = $request->all();
	create_form_config();
}


function create_form_config() {

    // Optional fields
    $optionalFields = ['recipient', 'save', 'webhook'];

    // Setup required fields
    $fieldConfig = [
        'name'      => $this->input['name'],
        'fields'    => $this->input['fields'],
    ];

    // Add optional fields
    foreach ( $optionalFields as $key => $value ) {
        if ( !is_null($value) ) $fieldConfig[$key] = $value; 
    }

    return $fieldConfig;

}
Activity icon

Replied to Undefined Variable When Passing Data To A Function Or Method

Okay, so am not completely sure, but I once had a problem where data was disappearing when using functions within a controller class. The page wouldn't load.

I fixed this by taking the code and just slapping it straight in without making a function for it. Try this, if this doesn't work, then I am misunderstanding where you dd(func_get_args()). Would you not dd $input, inside the create_form_config.

May
18
2 months ago
Activity icon

Replied to Prevent Cascading Parameteres (OOP Solution Needed)

Yeah sorry my images was so clear.

I just found out something new, and that is, if you are using a switch statement with two methods inside, kinda like shown above, inside the same class of course, the view isn't shown.

Its only when I took the code from the method and dumped it where the method call is that it worked.

I have no explanation for this. Maybe it has something to do with the return and break, I am not sure.

Activity icon

Started a new Conversation Prevent Cascading Parameteres (OOP Solution Needed)

From my View I am directed to a Utilities Class which updates the address. The only problem is, is that I have two separate pages, sending different variables. So I have had to create it in such away that it goes as such.

+-------------+
|             |
|    VIEW     |
|             |
+------+------+
       |
       v
+------+----------+
|                 |
|    Utilities    | CLASS
|                 |
+------+----------+
       |
       v
+------+----------------------------------+
|                                         |
|    Update Address (Request $request)    | METHOD
|                                         |
|                                         |
|    method x ($request)                  |
|    method y ($request)                  |
|                                         |
+--------------------+--------------+-----+
                     |              |
                     v              v
+--------------------+------+  +----+--------------------+
|                           |  |                         |
|    method x ($request)    |  |   method y ($request)   |  METHODS
|                           |  |                         |
+---------------------------+  +-------------------------+

How do I stop the cascade of the $request. There must be a simpler and tidier way of doing this.

May
17
2 months ago
Activity icon

Replied to Blade Action ('some Method In Some Far Off Controller!')

The POST method is not supported for this route. Supported methods: GET, HEAD.

Question 1: is there a way in laravel where I can just do < ? p h p ?>, or should I just use this?

Activity icon

Started a new Conversation Blade Action ('some Method In Some Far Off Controller!')

Hi, I am attempting to run a function in blade in some far off controller, instead of copying and pasting it.

My only concern here is, will Laravel prevent this due to how my routes are set up? and can this be fixed by just having a utilities controllers and dumping a bunch of code which does specific functions in here so it has access.

Or is the above nonsense and the code below is wrong.

{{ action('TTobacco\Customer\[email protected]') }}
Activity icon

Replied to Isset @extend This View, Else @extend This View

Oh thank you so much, this worked perfectly.

Just out of interest, what was your previous answer so I know how to see the error in the future.

Activity icon

Replied to Isset @extend This View, Else @extend This View

syntax error, unexpected 'isset' (T_ISSET), expecting ')' (0)
Activity icon

Started a new Conversation Isset @extend This View, Else @extend This View

I am trying to use one page for two users, but the two users have separate layouts. I thought it would be as simple as this.

@if(isset($datas['carts']))
   @extends('layouts.app') @section('title', 'Checkout') @section('content')
@endif

@if(isset($datas['product']))
   @extends('layouts.coteheath') @section('title', 'Checkout') @section('content')
@endif

The outcome is that the first layout.coteheath, since this var is filled, is produced, with the page in question, and then the second layout.app is produced, even though the var is not filled.

So the final outcome is that I have a double page displayed.

+--------------------+
|  layout.coteheath  |
+--------------------+
|                    |
|  checkout page     |
|                    |
|                    |
|                    |
+--------------------+
|  layout.app        |
+--------------------+
|                    |
|  checkout page     |
|                    |
|                    |
|                    |
|                    |
+--------------------+
Activity icon

Replied to URL 404 Issue

Sorry guys, stupid mistake on my part.

May
15
2 months ago
Activity icon

Started a new Conversation URL 404 Issue

I am having an issue where I am trying to use the helper of the URL instead of the route helper. The confusing thing is that I had it working, and now even though everything is pointing to the fact it should work, I am still returned with a 404.

Am hoping some insight can help.

View

<a href="{{ url('checkout', ['basic']) }}" class="btn btn-dark btn-lg btn-block" style="color: white;">Purchase</a>

Route

Route::namespace('CoteHeath\Customer')->prefix('cuser')->name('cuser.')->middleware('auth')->group(function () 
{
    Route::get('checkout/{slug}', '[email protected]');
});

Controller

public function index($package)
{
	echo "Hello world";
}
May
07
3 months ago
Activity icon

Replied to Auth Null Inside Constructor

Am such a noob I just created new middleware. Thanks for your help.

Activity icon

Replied to Auth Null Inside Constructor

Hey so please tell me is it best practice to run my middleware for auth inside the constructor of a class or to just leave it in the routes.

The best answer would be, which will cause me less problems in the future.

Activity icon

Started a new Conversation Auth Null Inside Constructor

Hello, I am having trouble with the

//Not working
    public function __construct() 
    {
        $user = Auth::user();
        dd($user);
    }

inside my constructor, I was just wondering was it is empty or to be more specific, why does it return null, where has if I am to run it in my index I have all data returned perfectly. I tried searching for an explanation and have no answer.

//Working
    public function index() 
    {
        $user = Auth::user();
        dd($user);
    }

And the web.php

Auth::routes();

// User
Route::namespace('TTobacco\Customer')->prefix('user')->name('user.')->middleware('auth')->group(function () {

    // TTobacco User Area
    Route::get('/home', '[email protected]');
May
06
3 months ago
Activity icon

Started a new Conversation Create .bat To Run Php Artisan Serve

Hi, is what I am asking possible. I tried this.

@ECHO OFF
cd C:\Users\Josh\Desktop\Files\websites\T-Tobacco
php artisan serve
PAUSE
May
05
3 months ago
Activity icon

Started a new Conversation Access Level Of A Non Object

if(Auth::user()->access_level != 2)
        {
            echo "You are in the wrong location my friend...";
        }

I know this is the incorrect way of doing it after following a roles tutorial, but I am just wondering why this is happening.

Activity icon

Awarded Best Reply on About Stripe Payment Issues

I was messing with this for days. But I final got there!

Here is my solution:

<script src="https://js.stripe.com/v3/"></script>
<script src="{{ asset('js/my_stripe.js') }}"></script>
<link rel="stylesheet" type="text/css" href="{{ asset('css/stripe.css') }}">

<form action="/user/payment/stripe" method="post" id="payment-form">
{{ csrf_field() }}

<div class="row">
<div class="col-md-12 mb-3">
<label for="firstName">Enter Card Details</label>
 <div id="card-element">
<!-- A Stripe Element will be inserted here. -->
</div>
</div>
 </div>

 <div id="card-errors" role="alert"></div>
 </div>

<button id="complete-orders" class="btn btn-success btn-block">Submit Payment</button>
</form>

<script>
// Create a Stripe client.
var stripe = Stripe('auth stuff here');

// Create an instance of Elements.
var elements = stripe.elements();

// Custom styling can be passed to options when creating an Element.
// (Note that this demo uses a wider set of styles than the guide below.)
var style = {
   base: {
      color: '#32325d',
      fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
      fontSmoothing: 'antialiased',
      fontSize: '16px',
      '::placeholder': {
         color: '#aab7c4'
      }
   },
   invalid: {
      color: '#fa755a',
      iconColor: '#fa755a'
   }
};

// Create an instance of the card Element.
var card = elements.create('card', 
{
   style: style,
   hidePostalCode:true
});

// Add an instance of the card Element into the `card-element` <div>.
card.mount('#card-element');

// Handle real-time validation errors from the card Element.
card.addEventListener('change', function(event) {
   var displayError = document.getElementById('card-errors');
   if (event.error) {
      displayError.textContent = event.error.message;
   } else {
      displayError.textContent = '';
   }
});

// Handle form submission.
var form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
   event.preventDefault();

   var options = {
      name: document.getElementById('card-name').value,
      address_line1: document.getElementById('card-address').value,
      address_city: document.getElementById('card-city').value,
      address_state: document.getElementById('card-province').value,
      address_zip: document.getElementById('card-postcode').value,
   };

   document.getElementById('card-city').disable = true;

   stripe.createToken(card, options).then(function(result) {
      if (result.error) {
         // Inform the user if there was an error.
         var errorElement = document.getElementById('card-errors');
         errorElement.textContent = result.error.message;
         document.getElementById('card-city').disable = false;
      } else {
         // Send the token to your server.
         stripeTokenHandler(result.token);
      }
   });
});

// Submit the form with the token ID.
function stripeTokenHandler(token) {
   // Insert the token ID into the form so it gets submitted to the server
   var form = document.getElementById('payment-form');
   var hiddenInput = document.createElement('input');
   hiddenInput.setAttribute('type', 'hidden');
   hiddenInput.setAttribute('name', 'stripeToken');
   hiddenInput.setAttribute('value', token.id);
   form.appendChild(hiddenInput);

   // Submit the form
   form.submit();
}
</script>

Controller

\Stripe\Stripe::setApiKey('Auth key');

            // Token is created using Stripe Checkout or Elements!
            // Get the payment token ID submitted by the form:
            $token = $_POST['stripeToken'];

            try {
                $charge = \Stripe\Charge::create([
                    'amount' => $this->total,
                    'currency' => 'gbp',
                    'description' => Carbon::now().' '.$request->input('lastName'),
                    'source' => $token,
                ]); 
            } catch(\Stripe\Exception\CardException $e) {
                $request->session()->flash('fail-message', 'Your payment was declined.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\RateLimitException $e) {
                $request->session()->flash('fail-message', 'To many requests to the API.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\InvalidRequestException $e) {
                $request->session()->flash('fail-message', 'Invalid parameters.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\AuthenticationException $e) {
                $request->session()->flash('fail-message', 'There are problems with authentication.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\ApiConnectionException $e) {
                $request->session()->flash('fail-message', 'There is a problem with the network.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\ApiErrorException $e) {
                $request->session()->flash('fail-message', 'There is a problem with the API.');
                return redirect()->route('checkout');
            } catch (Exception $e) {
                $request->session()->flash('fail-message', 'We don\'t know what happened.');
                return redirect()->route('checkout');
            }

Edit: if you want to see there details on your dashboard you can use this, but just follow what I have done and everything will work. Its important to understand that I didn't include all the html so the inputs for the options are missing.

var options = {
      name: document.getElementById('card-name').value,
      address_line1: document.getElementById('card-address').value,
      address_city: document.getElementById('card-city').value,
      address_state: document.getElementById('card-province').value,
      address_zip: document.getElementById('card-postcode').value,
   };

   document.getElementById('card-city').disable = true;

   stripe.createToken(card, options).then(function(result) {
      if (result.error) {
May
01
3 months ago
Activity icon

Replied to What Is The Difference Between @section And @include.

But I want the dashboard only to be seen by an admin and not by a user. With the laravel auth system, would not the user also see this dashboard.

Activity icon

Started a new Conversation What Is The Difference Between @section And @include.

I am currently trying to get @section to work and not succeeding. I have a file in my layouts called "dashboard.blade.php" but when I call it nothing appears.

@section('layout.dashboard') @yield

It just throws an error. But the documentation is saying that this is what needs to show the dashboard layout.

Please help.

Activity icon

Replied to About Stripe Payment Issues

I was messing with this for days. But I final got there!

Here is my solution:

<script src="https://js.stripe.com/v3/"></script>
<script src="{{ asset('js/my_stripe.js') }}"></script>
<link rel="stylesheet" type="text/css" href="{{ asset('css/stripe.css') }}">

<form action="/user/payment/stripe" method="post" id="payment-form">
{{ csrf_field() }}

<div class="row">
<div class="col-md-12 mb-3">
<label for="firstName">Enter Card Details</label>
 <div id="card-element">
<!-- A Stripe Element will be inserted here. -->
</div>
</div>
 </div>

 <div id="card-errors" role="alert"></div>
 </div>

<button id="complete-orders" class="btn btn-success btn-block">Submit Payment</button>
</form>

<script>
// Create a Stripe client.
var stripe = Stripe('auth stuff here');

// Create an instance of Elements.
var elements = stripe.elements();

// Custom styling can be passed to options when creating an Element.
// (Note that this demo uses a wider set of styles than the guide below.)
var style = {
   base: {
      color: '#32325d',
      fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
      fontSmoothing: 'antialiased',
      fontSize: '16px',
      '::placeholder': {
         color: '#aab7c4'
      }
   },
   invalid: {
      color: '#fa755a',
      iconColor: '#fa755a'
   }
};

// Create an instance of the card Element.
var card = elements.create('card', 
{
   style: style,
   hidePostalCode:true
});

// Add an instance of the card Element into the `card-element` <div>.
card.mount('#card-element');

// Handle real-time validation errors from the card Element.
card.addEventListener('change', function(event) {
   var displayError = document.getElementById('card-errors');
   if (event.error) {
      displayError.textContent = event.error.message;
   } else {
      displayError.textContent = '';
   }
});

// Handle form submission.
var form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
   event.preventDefault();

   var options = {
      name: document.getElementById('card-name').value,
      address_line1: document.getElementById('card-address').value,
      address_city: document.getElementById('card-city').value,
      address_state: document.getElementById('card-province').value,
      address_zip: document.getElementById('card-postcode').value,
   };

   document.getElementById('card-city').disable = true;

   stripe.createToken(card, options).then(function(result) {
      if (result.error) {
         // Inform the user if there was an error.
         var errorElement = document.getElementById('card-errors');
         errorElement.textContent = result.error.message;
         document.getElementById('card-city').disable = false;
      } else {
         // Send the token to your server.
         stripeTokenHandler(result.token);
      }
   });
});

// Submit the form with the token ID.
function stripeTokenHandler(token) {
   // Insert the token ID into the form so it gets submitted to the server
   var form = document.getElementById('payment-form');
   var hiddenInput = document.createElement('input');
   hiddenInput.setAttribute('type', 'hidden');
   hiddenInput.setAttribute('name', 'stripeToken');
   hiddenInput.setAttribute('value', token.id);
   form.appendChild(hiddenInput);

   // Submit the form
   form.submit();
}
</script>

Controller

\Stripe\Stripe::setApiKey('Auth key');

            // Token is created using Stripe Checkout or Elements!
            // Get the payment token ID submitted by the form:
            $token = $_POST['stripeToken'];

            try {
                $charge = \Stripe\Charge::create([
                    'amount' => $this->total,
                    'currency' => 'gbp',
                    'description' => Carbon::now().' '.$request->input('lastName'),
                    'source' => $token,
                ]); 
            } catch(\Stripe\Exception\CardException $e) {
                $request->session()->flash('fail-message', 'Your payment was declined.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\RateLimitException $e) {
                $request->session()->flash('fail-message', 'To many requests to the API.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\InvalidRequestException $e) {
                $request->session()->flash('fail-message', 'Invalid parameters.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\AuthenticationException $e) {
                $request->session()->flash('fail-message', 'There are problems with authentication.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\ApiConnectionException $e) {
                $request->session()->flash('fail-message', 'There is a problem with the network.');
                return redirect()->route('checkout');
            } catch (\Stripe\Exception\ApiErrorException $e) {
                $request->session()->flash('fail-message', 'There is a problem with the API.');
                return redirect()->route('checkout');
            } catch (Exception $e) {
                $request->session()->flash('fail-message', 'We don\'t know what happened.');
                return redirect()->route('checkout');
            }

Edit: if you want to see there details on your dashboard you can use this, but just follow what I have done and everything will work. Its important to understand that I didn't include all the html so the inputs for the options are missing.

var options = {
      name: document.getElementById('card-name').value,
      address_line1: document.getElementById('card-address').value,
      address_city: document.getElementById('card-city').value,
      address_state: document.getElementById('card-province').value,
      address_zip: document.getElementById('card-postcode').value,
   };

   document.getElementById('card-city').disable = true;

   stripe.createToken(card, options).then(function(result) {
      if (result.error) {
Apr
30
3 months ago
Activity icon

Started a new Conversation Route Not Defined (It Is Trust Me!)

Route [user-products] not defined.

The error message is clearly saying that my route hasn't been created in the web.php but under inspection I can clearly see that it is. The view link being:

return redirect()->route('user-products');

with the corresponding route link:

Route::get('/view-products', '[email protected]')->name('user-products');
Apr
28
3 months ago
Activity icon

Started a new Conversation Route OR URL

Which Laravel helper is more worth while to user out of the two here.

(( ( – -) ((‘) (’)

Activity icon

Replied to Customer Folder For Controller

Thank you!

Activity icon

Started a new Conversation Customer Folder For Controller

Hi, I dropped my Admin and User folders inside a new folder, lets called it Project X and now I am wondering how do I route to these folders in the route php.

Apr
27
3 months ago
Activity icon

Replied to Can You REDIRECT In BLADE?

Yeah! Why am I even doing it like this, its crazy! Thank you.

Activity icon

Started a new Conversation Can You REDIRECT In BLADE?

I have some code which is working fine, but on one exit I don't want to have the same layout template, but I need it to change, the only way I can imagine this happening is that I am able to redirect to a url.

@extends('layouts.app')
 
@section('content')

@if(auth()->check())
    @if(auth()->user()->access_level == 0)
        @include('admin.home')
    @elseif(auth()->user()->access_level == 1)
        @include('welcome')
    @elseif(auth()->user()->access_level == 2)
        @include('user.home')
    @endif
@else 
    <div class="container mt-5">
        <div class="alert alert-danger" role="alert">
            Your session has timed out - <a href="login">log back in</a>.
        </div>
    </div>
@endif

@endsection

The user with access level 1 should have another navigation bar. I have also come to realize that the way I have created my users system is not good at all when it comes to changing or creating more users. Please if anyone knows where I can find a tutorial or article which can teach me how this is done properly I would be forever thankful.

Apr
20
3 months ago
Activity icon

Replied to Prefered Method Of Interaction Between Live Production

Thanks guys for the input!

Apr
19
3 months ago
Activity icon

Started a new Conversation Prefered Method Of Interaction Between Live Production

Hey, I have just starting working on my website whilst it is hosted to the server. My first question is, what is your prefered method of interaction between you and the server.

File Manager SSH

And if you are using SSH, what is your prefered text editor, nano or vim?

Also I just found out that you are about the SSH using Visual Code, but after the recent update that is no longer possible, I would say this would be my main prefered method, but I am unable to get it to work up to now.

So guys if you are willing I would love to hear your suggestions.

Apr
17
3 months ago
Activity icon

Started a new Conversation Input Select, Selecting The Correct Option On Page Load!

Input Select, Selecting the Correct Option on Page Load!

On my page, the user is using a drop down to select their address, from there they are updated with the input fields updated with the right data. The problem is that there is one input field that I am struggling to update, and that is the field.

I have managed to select one country, which I my primary target country for selling to, but that is done by typing on the html input, now I know I can have something such as

@if ($var == "GB")
	echo 'selected';
@endif

but to do this for over 100 entries seems crazy. Please help.

Apr
16
3 months ago
Activity icon

Replied to Deploying Laravel Access Denied

I cannot believe it, I have been working on this for hours. Then I submit this post and POW everything works like magic!

Hello Mark! Massive thank you for all your input!

I am pretty sure I will run into a million more problems.

Activity icon

Started a new Conversation Deploying Laravel Access Denied

I am using a shared hosting site, after switching because of poor service I have found a great company to host my site. After taking great advice from fellow laracasts and reading other articles on the matter I have come to the decision that the best course of action is to have

domain > public_html | website_files

public_html > (all public files including the all important 'index.php')

I go into the index.php and change the file path and I am given a cannot access error. I am at the point where I have tried everything and there is no clear instructions.

require __DIR__.'/../../website/vendor/autoload.php';
$app = require_once __DIR__.'/../../website/bootstrap/app.php';
Apr
14
3 months ago
Activity icon

Replied to Symlink To Storeage Folder In The Public

Okay I will move it. Snapey, is there anyway I can connect with you? Email?

Activity icon

Replied to Database Credentials Cached

Thanks guy, I just wanted to make sure.

Activity icon

Started a new Conversation Symlink To Storeage Folder In The Public

Hi, I need to create a symlink from storage to public storage. The problem is is that my directories have changed because its on shared hosting. So I am unable to run php artisan storage:link.

The server is running linux. My folder structure is like this

[~/public_html/public]# 
./   .htaccess  css/       favicon.ico   index.php  phpinfo.php  storage/
../  TTobacco/  error_log  fontawesome/  js/        robots.txt   web.config
[~/public_html/public/website]# dir
./              .styleci.yml   ecommerce-backup.sql  routes/
../             app/           error_log             server.php
.editorconfig   artisan        node_modules/         storage/
.env            bootstrap/     package-lock.json     tests/
.env.example    composer.json  package.json          vendor/
.gitattributes  composer.lock  phpunit.xml           webpack.mix.js
.gitignore      config/        readme.md
.htaccess       database/      resources/

So I need to create the symlink from the public/website/storage to the public/storage.

Please help, I tried what was written in the google search but it just wasn't doing what I needed. I cannot see any of my images.

Activity icon

Started a new Conversation Database Credentials Cached

I have a problem where I changed the password of the user that can access and have all privileges to the database. The problem is, is that the old password is cached. Now am new to the environment and am a little worried to change anything, since now its working.

Can anyone tell me why the credentials are cached and how can I get rid of them to take the new credentials.

Activity icon

Replied to 419 Error After Trying To Login Or Create A New User.

I want to thank everyone for helping, am still not quite sure how I got it working, but I think it had something to do with the php version being out dated.

Once I got the admin to update to php version in all directories then things started to work.

Apr
10
3 months ago
Activity icon

Replied to 419 Error After Trying To Login Or Create A New User.

How do I check my source files, are you talking about my controllers etc. I checked and there is nothing in front of the <?php.

Activity icon

Replied to 419 Error After Trying To Login Or Create A New User.

Yes other pages are working. Check it out for yourself. https://ttobacco.org/public/, also there seems to be no way I can get rid of the public, but am guessing it is something to do with the htaccess file.