Presto

Presto

Member Since 4 Years Ago

Boise, ID

Web Engineer at D&B Supply

Experience Points 18,190
Experience Level 4

1,810 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 215
Lessons
Completed
Best Reply Awards 1
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

05 Jan
2 years ago

Presto left a reply on Algolia Distinct Count

Still new to algolia myself, but would this be a faceted search? We were playing around with this yesterday, it will display the total number of items found that was match in each of the attributes passed.

Look in your Algolia dashboard > Indices > Display > Faceting.

Not sure if that is what you need or not.

Presto left a reply on Algolia Search By Category ID

Here is a snippet of my code:

/**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show(Request $request, $slug)
    {

        /**
         * Lookup the category by the slug
         * and return the id
         */
        $category =  Page::where('slug', $slug)->first();

        if ($category) {

            /**
             * Run Algolia Search
             *
             * Search for only products where their category
             * id matches the one returned above
             */
            $client = new Client(env('ALGOLIA_APP_ID'), env('ALGOLIA_SECRET'));
            $results = $client->initIndex(env('ALGOLIA_INDEX'));
            $products = $results->search($category->id, ['restrictSearchableAttributes' => ['catid']]);

            dd($products);

Presto started a new conversation Algolia Search By Category ID

Not sure how many there are of us using Algolia on here but thought I would ask and see if anyone else has ran into this before. Ok, I'm trying to do a search and find all products on Algolia where catid is equal to let's say 10. Reading the Algolia REST API Documentation they note a search parameter "restrictSearchableAttributes", this from what I can tell allows us to limit the search to only one attribute, in my case search only catid.

Anyone else using Algolia search like this?

22 Dec
2 years ago

Presto left a reply on Using Elixir Versioning With Git

I thought I would chime in with my two cents, I too was in the same boat, working on a team using git version control, we were running into issues with multiple files getting tracked by git every time someone would check in a new build.

I ended up going with Laravel Elixir Git Add, I wrote a blog post about our setup here, for anyone else running into the same problem.

16 Dec
2 years ago

Presto left a reply on NoSQL In Laravel

@DirkZz, I can see where you are coming from, I too was making that argument with my teammates a few months back, but now that I have been using it for a few months on a live project I personally have a hard time seeing why you, (or really I) would want to use MySQL.

@DirkZz and everyone else, I'm not trying to come off as "preachy", all I'm saying is more and more users are starting to use a NoSQL solution and there is a place for it in the framework, and I think if you used it you would see it's a great option for a blog to a large-scale e-commerce site.

MySQL seems really old and clunky to me now, saving empty data/columns for consistency; just seems like an old school way of thinking, and I'm old school so I know what I'm talking about (joking) just look at all of the gray in my beard lol. Again these are just my thoughts from someone who is actively using a MongoDB daily.

Ultimately that'll be a decision that @TaylorOtwell will make, if he sees value in adding it to the framework.

Presto left a reply on NoSQL In Laravel

Hey @harryg we started using MongoDB at work several months back, I was not excited at all when we started using it, but now that I have used it and seen the true POWER of the dark side ;) I have a hard time finding a use case for MySQL over MongoDB. I personally believe that developers who try and argue the point may not have ever used MongoDB in a live project before.

Like you pointed out there are some packages out there to help, we use jenssegers/laravel-mongodb, I wish that MongoDB was baked into Laravel out of the box, once you take the red MongoDB pill there is no going back :)

For anyone on the fence, you should give it a try, it's awesome!

06 Dec
2 years ago

Presto started a new conversation Bootstrap JavaScript Not Working Within Vue App, Why?

Ok can anyone tell me why my Boostrap (Native Vanilla JavaScript) is not working within my Vue app?

DEMO: http://codepen.io/CSWApps/pen/eBrpqx

To test my code, if you change the app ID to something like app2 and Bootstrap starts working, obviously vue will not work at this point but you can see what I'm talking about.

13 Jun
2 years ago

Presto left a reply on Guide: Add Webpack To Your Laravel-Elixir Ext For Vue Js Components

Thanks @midascodebreaker,

That got me past that issue, not this error comes up:

**Uncaught TypeError: plugin.apply is not a function - vue.js:8330**

** Sigh **... It feels like it is almost working, I just went back and followed your steps again, and then also gave the steps on (https://github.com/dolbex/webpack-laravel)[here] a try, both lead back to the same plugin.apply is not a function error.

10 Jun
2 years ago

Presto left a reply on Guide: Add Webpack To Your Laravel-Elixir Ext For Vue Js Components

Ok I tweeked my webpack.config.js file and got past that error now I'm getting the same error as @phoenixcorp is getting. @phoenixcorp were you able to get it working?

Currently getting the following error:

Uncaught TypeError: $export is not a function

On line 2164:

  $export($export.S + $export.F * !__webpack_require__(34), 'Object', { defineProperty: __webpack_require__(30).f });

Presto left a reply on Guide: Add Webpack To Your Laravel-Elixir Ext For Vue Js Components

Thanks for writing this tut. @midascodebreaker, after following your steps, when I run gulp, I don't get any errors, in terminal but I get the following error in Chrome DevTools:

app.js:55 Uncaught SyntaxError: Unexpected token import

On line 55 in app.js:

import Vue from 'vue';
10 May
2 years ago

Presto left a reply on Password Generator

If you have a password field on the frontend you could do something like this:

http://codepen.io/CSWApps/pen/sBzmy

Then Laravel could encrypt the password before saving to the database.

29 Mar
2 years ago

Presto left a reply on Use Model As Max In For Loop?

Thanks for your replies, so I ended up finding that you can attach a v-for directly to the component like below, this is my working code.

<input type="number" v-model="numberOfButtons" number />

<my-button v-for="btn in numberOfButtons"></my-button>

<template id="buttonTemplate">
  <button>Button</button>
</template>
28 Mar
2 years ago

Presto started a new conversation Use Model As Max In For Loop?

I'm trying to use a number (or text) input to set the total number of list items to be created with a v-for loop, and it does not seem to work?

If I set the number in v-for it works

<input type="number" v-model="number_of_buttons" number />
<my-button></my-button>
<template id="buttonTemplate">
  <div v-for="btn in 4">
    <button>Button</button>
  </div>
</template>

But if I change it to use the model, it stops working

<input type="number" v-model="number_of_buttons" number />
<my-button></my-button>
<template id="buttonTemplate">
  <div v-for="btn in number_of_buttons">
    <button>Button</button>
  </div>
</template>

My Vue code looks like this

var buttonTemplate = Vue.extend({
  template: '#buttonTemplate'
})

Vue.component('my-button', buttonTemplate)

new Vue({
  el: '#app',
  data: {
    number_of_buttons: 3,
  }
})
10 Mar
3 years ago

Presto started a new conversation Virtualbox & VMWare Fusion Running

When I run homestead global-status I have two machines running.

id       name    provider      state   directory                                        
----------------------------------------------------------------------------------------
d8fa29e  default virtualbox    running /Users/Presto/.composer/vendor/laravel/homestead 
2912448  default vmware_fusion running /Users/Presto/Homestead  

Is that correct, I mean normal? I setup the machine sveral months back, I downloaded and installed Vagrant, paid for both VMWare, and the Vagrant plugin, install all 3, I think my main system is running on vmware_fusion within /Users/Presto/Homestead, if I mistakenly installed virtualbox and a machine is running as it looks like one is, and it is not needed how do I stop it, and remove it from my system?

Also how do I confirm 2912448 default vmware_fusion running /Users/Presto/Homestead is my main machine.

Many thanks for any guidance you can give.

08 Mar
3 years ago

Presto left a reply on Login Route Redirecting To Image!?!

Its strange it does not to it all of the time, plus nothing is showing up in the logs ether, very strange.

Presto left a reply on Login Route Redirecting To Image!?!

Ok I commented out everything except the following and it still did the same thing what the hell? Plot thickens!

Route::group(['middleware' => 'web'], function() {
    Route::get('/', function () {return Auth::check() ? redirect('/categories') : view('pages.index');});
    Route::Auth();
    Route::get('categories', 'CategoriesController@index');
});

Presto left a reply on Login Route Redirecting To Image!?!

So here is my complete routes.php file

Route::group(['middleware' => 'web'], function() {

    // Pages Rotes
    Route::get('/', function () {return Auth::check() ? redirect('/categories') : view('pages.index');});
    Route::get('/terms', function () {return view('pages.terms');});
    Route::get('/privacy-policy', function () {return view('pages.privacy-policy');});
    Route::get('/contact', function () {return view('pages.contact');});

    // Auth Routes
    Route::Auth();

    // Profile Routes
    Route::get('account', ['middleware' => 'auth', function(){
        $user = App\User::find(\Auth::user()->id);
        return view('pages.account', compact('user'));
    }]);

    // Show User's Profile
    Route::get('user/{id}', function($id){
        $user = App\User::findOrFail($id);
        return view('pages.user_profile', compact('user'));
    });

    Route::put('account', 'ProfileController@update');
    Route::get('state/{state}', 'ProfileController@setState');

    Route::get('posts/favorites', 'PostsController@favorites');
    Route::get('p/{alias}', 'PostsController@directLink');
    Route::resource('posts', 'PostsController');
    Route::resource('photos', 'PhotosController');
    Route::get('categories', 'CategoriesController@index');
    Route::resource('comments', 'CommentsController');
    Route::get('{alias}', 'CategoriesController@show');
    Route::get('{alias}/{post}', 'PostsController@show');

});

Presto started a new conversation Login Route Redirecting To Image!?!

Hey, So I'm using the Route::Auth() route within my web middleware running Laravel 5.2, when you sign in it redirects to to a uri like this https://mydomain.io/img/favicon.ico what the F&$% !?!

My routes.php file looks something like this

Route::group(['middleware' => 'web'], function() {
    Route::Auth();
});

Has anyone see Laravel do this before?

Presto left a reply on Pre Validate Stripe Coupon Before Checkout

Really, I mixed up my Stripe keys, stupid... stupid... stupid... Well peeps, always confirm your Stripe keys is the lesson for today lol.

Presto started a new conversation Pre Validate Stripe Coupon Before Checkout

I have a function setup to validate a Stripe coupon code, this function is called via an Ajax call when the coupon field on my checkout form loses focus. The function has been working grate, but today a user let me know that the coupon returned false, I tested it and got the same thing, the coupon code is in my Stipe dashboard and it is under the live tab. Not sure if the Stipe package got updated and broke my code or what, I'm not getting any on screen errors or errors in my log.

public function isCouponValid($coupon)
{
    \Stripe\Stripe::setApiKey( env('STRIPE_SECRET') );
    try {
        $status = \Stripe\Coupon::retrieve( $coupon );
        if($status->amount_off) {
            $price = currencies( strtoupper( $status->currency ) ) . ' ' . $status->amount_off . ' ' . $status->duration;
        } else {
            if( $status->duration == 'repeating' ) {
                $duration = '(' . $status->duration_in_months . ' months)';
            } else {
                $duration = '(forever)';
            }
            $price = $status->percent_off . '% for ' . $duration;
        }
        return ['status'=>'true','msg'=>$price];
    } catch(\Exception $e) {
        return ['status'=>'false'];
    }
}
06 Mar
3 years ago

Presto left a reply on Vue, Browserify, And VueStrap Help

Well this sucks, it looks like the package does not seem to be working with Elixir, and Browserify, I found both of these bugs:

https://github.com/yuche/vue-strap/issues/112 https://github.com/yuche/vue-strap/issues/55

05 Mar
3 years ago

Presto left a reply on NPM Install Acting Weird

This is also happening to me to, I was not sure if it was normal or not, but seemed odd that 100s of non requested scripts would be installed too. Hope someone can shed some light on this.

Presto started a new conversation Vue, Browserify, And VueStrap Help

I'm new to Vue, and Browserify, I'm trying to use VueStrap with my project too, I am unable to get gulp to compile down, when I run gulp I get 58 errors like follows:

Browserify Failed!: Cannot find module '!!./../node_modules/css-loader/index.js!./../node_modules/vue-loader/lib/style-rewriter.js?id=_v-3ea9213b&file=Typeahead.vue!./../node_modules/vue-loader/lib/selector.js?type=style&index=0!./Typeahead.vue' from '/Users/Presto/Code/vuestrap/node_modules/vue-strap/dist'

So I'm guessing I'm not doing something correctly.

*** Here is my Gulp file contents

var elixir = require('laravel-elixir');
require('laravel-elixir-vueify');
elixir(function(mix) {
    mix.browserify('app.js');
    mix.version('js/app.js');
});

*** Here is my app.js contents

var Vue = require('vue');
var VueStrap = require('vue-strap');

I used NPM to install Vue, and VueStrap, and both are in my node_modules directory, and they are both listed in my package.json file under dependencies. Please let me know what I'm missing, thank you so much for your direction, and guidance.

26 Feb
3 years ago

Presto left a reply on Modifying Column Type Migration

Thanks for the reply @petrit in my composer.json file, under "require-dev" I have "doctrine/dbal": "2.5.1".

Presto started a new conversation Modifying Column Type Migration

Ok so I'm trying to modify a column type in my database from a bigInteger to a string, when I run the migration I keep getting an error message saying that there is no column named *sku when I can clearly see it is there?!?

Here is my first migration that creates the table

Schema::create('products', function (Blueprint $table) {
    $table->bigIncrements('id');
    $table->bigInteger('sku');
    $table->timestamps();
});

Here is my migration to change the column type

Schema::table('products', function (Blueprint $table) {
    $table->string('sku')->change();
});

This is the error

  • There is no column with name 'sku' on table 'products'

Presto started a new conversation VueStrap Typehead Not Working ;(

Hello,

I'm trying to get VueStrap's Typehead working, it seems to be loading correctly, but when you type in the field it is not firing a request to the Github API. Can you see anything that I have missed?

http://codepen.io/CSWApps/pen/reBZjB/

13 Feb
3 years ago

Presto left a reply on @click Within V-for?

Ok so what I ended up doing was replacing my onclick function with @click="deletePost(post)", then updated my Vue method's function with the following.

deletePost: function (post) {
    this.posts.$remove(post);
},

Presto started a new conversation @click Within V-for?

Ok so I'm new to Vue, I have been searching around to see if I could find the answer, but I guess I'm not searching for the correct terms.

I'm trying to add a button with an v-on:click or for short @click within a v-for but Vue keeps removing the @click from my button, what gives? I'm guessing I cannot have Vue code within a Vue loop?

##Here is my loop

<ul class="list-group" id="app">
    <li class="list-group-item text-muted" v-for="post in posts">
        <div class="pull-right">
            <a href="/posts/@{{ post.id }}/edit" class="btn btn-success btn-xs"><span class="fa fa-wrench"></span> Edit</a>
            <button type="button" class="btn btn-danger btn-xs" @click="deletePost(@{{ post.id }})"><span class="fa fa-trash"></span> Delete</button>
        </div>
        <a href="@{{ post.url }}">@{{ post.title }}</a> - <strong>@{{ post.price }}</strong><br>
        <small>@{{ post.date }}</small>
    </li>
</ul>

##Here is my Vue App

new Vue({
  el: '#app',
  data: {
    posts: null
  },
  created: function () {
    this.fetchData()
  },
  methods: {

    fetchData: function () {
      this.$http.get('/posts').success(function(data){
        this.posts = data;
      });
    },

    deletePost: function (id) {

      swal({
        title: 'Confirm Deletion',
        text: 'Are you sure you want to delete this item, it cannot be undone?',
        showCancelButton: true,
        confirmButtonText: 'Yes, Delete It',
        confirmButtonColor: '#d9534f',
        closeOnConfirm: false,
        type: 'error',
      },
      function() {

        swal.disableButtons();

        this.$http.delete('/posts/'+id).success(function(response) {

          swal({
            title: 'Success!',
            text: 'The was deleted successfully!',
            type: 'success',
            timer: 2000,
            showConfirmButton: false
          });
          this.posts.$remove(id);

        }).error(function(errors) {

          swal({
            title: 'Error!',
            text: 'Something went wrong, the post was not deleted!',
            type: 'error',
            timer: 2000,
            showConfirmButton: false
          });

        });
      });
    }
  }
})
12 Feb
3 years ago

Presto left a reply on Auth Routes Not Working

Not sure, I removed my other auth routes and replaced with the blow and it started working.

Route::get('login', ['as' => 'auth.login', 'uses' => 'Auth\AuthController@showLoginForm']);
Route::get('post', ['as' => 'auth.login', 'uses' => 'Auth\AuthController@login']);
Route::get('logout', ['as' => 'auth.logout', 'uses' => 'Auth\AuthController@logout']);

// Registration Routes...
Route::get('register', ['as' => 'auth.register', 'uses' => 'Auth\AuthController@showRegistrationForm']);
Route::post('register', ['as' => 'auth.register', 'uses' => 'Auth\AuthController@register']);

// Password Reset Routes...
Route::get('password/reset/{token?}', ['as' => 'auth.password.reset', 'uses' => 'Auth\PasswordController@showResetForm']);
Route::get('password/email', ['as' => 'auth.password.email',  'uses' => 'Auth\PasswordController@sendResetLinkEmail']);
Route::post('password/reset'. ['as' => 'auth.password.reset', 'uses' => 'Auth\PasswordController@reset']);
11 Feb
3 years ago

Presto started a new conversation Auth Routes Not Working

What's up with my Auth routes? When you try and use any of the routes they redirect to an image WFT? I have never seen this before. I checked my log file and I'm not getting any errors in the log or on screen. But when I run route:list I get the following:

| GET|HEAD | auth/login/{one?}/{two?}/{three?}/{four?}/{five?}     | App\Http\Controllers\Auth\AuthController@getLogin      | web,guest |
| POST     | auth/login/{one?}/{two?}/{three?}/{four?}/{five?}     | App\Http\Controllers\Auth\AuthController@postLogin     | web,guest |
| GET|HEAD | auth/logout/{one?}/{two?}/{three?}/{four?}/{five?}    | App\Http\Controllers\Auth\AuthController@getLogout     | web,guest |
| POST     | auth/register/{one?}/{two?}/{three?}/{four?}/{five?}  | App\Http\Controllers\Auth\AuthController@postRegister  | web,guest |
| GET|HEAD | auth/register/{one?}/{two?}/{three?}/{four?}/{five?}  | App\Http\Controllers\Auth\AuthController@getRegister   | web,guest |
| GET|HEAD | password/broker/{one?}/{two?}/{three?}/{four?}/{five?}| App\Http\Controllers\Auth\PasswordController@getBroker | web,guest |
| GET|HEAD | password/email/{one?}/{two?}/{three?}/{four?}/{five?} | App\Http\Controllers\Auth\PasswordController@getEmail  | web,guest |
| POST     | password/email/{one?}/{two?}/{three?}/{four?}/{five?} | App\Http\Controllers\Auth\PasswordController@postEmail | web,guest |
| POST     | password/reset/{one?}/{two?}/{three?}/{four?}/{five?} | App\Http\Controllers\Auth\PasswordController@postReset | web,guest |
| GET|HEAD | password/reset/{one?}/{two?}/{three?}/{four?}/{five?} | App\Http\Controllers\Auth\PasswordController@getReset  | web,guest |
08 Feb
3 years ago

Presto left a reply on Get Data From Db In Partials Without Call In Controller

This is kind of hacky, but in your partial could you do something like

<ul>
@foreach(Property::recent() as $property)
    <li>{{ $property->address }}</li>
@endforeach 
</ul>

Presto left a reply on Get Data From Db In Partials Without Call In Controller

Or you could even do something like this

public function scopeRecent($query)
{
    return $query->take(3)->orderBy('id', 'desc')->get();
}

And to use it

$recent = Property::recent();

Presto left a reply on Get Data From Db In Partials Without Call In Controller

I think you would want a Model Scope.

public function scopeOrdered($query)
    {
        return $query->orderBy('id', 'desc')->get();
    }

Then you could do something like this

$recent = Property::take(3)->ordered();

Presto left a reply on Data Table Not Working Help ?

Is it displaying any errors?

06 Feb
3 years ago

Presto left a reply on New Comments Migration Error

Never mind, I found that migrate:rollback did not remove the comments table out for what ever reason, I manually deleted it from the database, then ran migrate again, and everything worked as it should.

Presto started a new conversation New Comments Migration Error

Hello everyone,

Not sure what I'm doing wrong, I keep getting the following error when I try and run a new migration, I'm guessing I have not set one of the column correctly.

Here is the error I get: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'comments' already exists (SQL: create table `comments` (`id` int unsigned not null auto_increment primary key, `parent_id` int unsigned not null, `post_id` int unsigned not n ull, `user_id` int unsigned not null, `description` varchar(255) not null, `created_at` timestamp not null, `updated_at ` timestamp not null) default character set utf8 collate utf8_unicode_ci)

Here is my schema:

            $table->increments('id');
            $table->integer('parent_id')->unsigned();
            $table->integer('post_id')->unsigned();
            $table->integer('user_id')->unsigned();
            $table->string('description');
            $table->timestamps();
            $table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->foreign('parent_id')->references('id')->on('comments')->onDelete('cascade');
        });```
28 Jan
3 years ago

Presto left a reply on Route Resource (Edit) Not Found

Awesome, that did the trick

{!! Form::model($flyer, ['route' => ['flyers.update', $flyer->flyernum], 'method' => 'put', 'class' => 'form-horizontal']) !!}

Thanks for your help @bashy!

Presto left a reply on Route Resource (Edit) Not Found

Ok, so I guess it is still not working, the page loads now but the form's action is not correct now,

<form method="POST" action="http://laravel.dev/flyers/%7Bflyers%7D/edit" accept-charset="UTF-8" class="form-horizontal">

Presto left a reply on Route Resource (Edit) Not Found

You where correct, I needed to change ['route' => ['flyers'] to ['route' => ['flyers.edit'], thanks @bashy

Presto left a reply on Route Resource (Edit) Not Found

I just found this:

{!! Form::model($flyer, ['route' => ['flyers'], 'method' => 'patch', 'class' => 'form-horizontal']) !!}

I'm guessing I may need to change ['route' => ['flyers'] to something else???

Presto left a reply on Route Resource (Edit) Not Found

I don't have anything like that in my view, here is the error for the log:

[2016-01-28 11:43:00] local.ERROR: exception 'InvalidArgumentException' with message 'Route [flyers] not defined.' in /html/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:306
Stack trace:
#0 /html/vendor/illuminate/html/FormBuilder.php(803): Illuminate\Routing\UrlGenerator->route('flyers', Array)
#1 /html/vendor/illuminate/html/FormBuilder.php(763): Illuminate\Html\FormBuilder->getRouteAction(Array)
#2 /html/vendor/illuminate/html/FormBuilder.php(104): Illuminate\Html\FormBuilder->getAction(Array)
#3 /html/vendor/illuminate/html/FormBuilder.php(146): Illuminate\Html\FormBuilder->open(Array)
#4 /html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(219): Illuminate\Html\FormBuilder->model(Object(App\Models\Flyers\FlyerHeader), Array)
#5 /html/storage/framework/views/57d1e9f70b6e066d0f2d577d53327b36(8): Illuminate\Support\Facades\Facade::__callStatic('model', Array)
#6 /html/storage/framework/views/57d1e9f70b6e066d0f2d577d53327b36(8): Illuminate\Html\FormFacade::model(Object(App\Models\Flyers\FlyerHeader), Array)
#7 /html/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(42): include('/html/...')
#8 /html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(58): Illuminate\View\Engines\PhpEngine->evaluatePath('/html/...', Array)
#9 /html/vendor/laravel/framework/src/Illuminate/View/View.php(135): Illuminate\View\Engines\CompilerEngine->get('/html/...', Array)
#10 /html/vendor/laravel/framework/src/Illuminate/View/View.php(106): Illuminate\View\View->getContents()
#11 /html/vendor/laravel/framework/src/Illuminate/View/View.php(80): Illuminate\View\View->renderContents()
#12 /html/vendor/laravel/framework/src/Illuminate/Http/Response.php(51): Illuminate\View\View->render()
#13 /html/vendor/symfony/http-foundation/Response.php(198): Illuminate\Http\Response->setContent(Object(Illuminate\View\View))
#14 /html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1229): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View))
#15 /html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(113): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View))
#16 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#17 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#18 /html/app/Http/Middleware/RedirectIfNotBackOffice.php(32): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#19 [internal function]: App\Http\Middleware\RedirectIfNotBackOffice->handle(Object(Illuminate\Http\Request), Object(Closure))
#20 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#21 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#22 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#23 /html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#24 /html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(69): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\FlyerController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'edit')
#25 /html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\Http\Contro...', 'edit')
#26 /html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(134): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
#27 /html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(708): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#28 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#29 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#30 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#32 /html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(710): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#33 /html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(675): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#34 /html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#35 /html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(236): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#36 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#37 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#38 /html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /html/app/Http/Middleware/VerifyCsrfToken.php(17): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 [internal function]: App\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#42 /html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#45 /html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#46 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#47 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#48 /html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#49 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#50 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#51 /html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#52 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#54 /html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#55 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#56 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#57 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#58 /html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#59 /html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#60 /html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(87): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#61 /html/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#62 {main}

Presto left a reply on Route Resource (Edit) Not Found

Sorry forgot to add that in my last post:

ErrorException in UrlGenerator.php line 306: Route [flyers] not defined. (View: /html/resources/views/flyers/edit.blade.php)

Presto started a new conversation Route Resource (Edit) Not Found

Hello everyone,

I'm stumped on this one, I created a route resource in my routes file, all of the routes are working except the edit route, why? If I run php artisan route:list and the edit route is listed:

POST | flyers | flyers.store | App\Http\Controllers\FlyerController@store GET|HEAD | flyers | flyers.index | App\Http\Controllers\FlyerController@index GET|HEAD | flyers/create | flyers.create | App\Http\Controllers\FlyerController@create DELETE | flyers/{flyers} | flyers.destroy | App\Http\Controllers\FlyerController@destroy GET|HEAD | flyers/{flyers} | flyers.show | App\Http\Controllers\FlyerController@show PUT | flyers/{flyers} | flyers.update | App\Http\Controllers\FlyerController@update PATCH | flyers/{flyers} | | App\Http\Controllers\FlyerController@update GET|HEAD | flyers/{flyers}/edit | flyers.edit | App\Http\Controllers\FlyerController@edit

My code in my routes file looks like this:

Route::resource('flyers', 'FlyerController');
09 Jan
3 years ago

Presto left a reply on Getting A MassAssignmentException Error At Registration

Ok I deleted the Subscription Model I created, then in my dashboard view I changed my plan select HTML to the blow and this fixed my issue.

<select name="plan" class="form-control">
  @foreach(plans() as $plan)
    <option value="{{ $plan['stripe_id'] }}"@if($user->onPlan( $plan['stripe_id'] ) == $plan['stripe_id']) selected="selected"@endif>{{ $plan['title'] }}</option>
  @endforeach
</select>

Presto left a reply on Getting A MassAssignmentException Error At Registration

Thanks for the reply, yes, this is my Subscription model.

namespace App;

use Illuminate\Database\Eloquent\Model;

class Subscription extends Model
{
    public function user()
    {
        return $this->belongsTo('App\User');
    }
}

Presto started a new conversation Getting A MassAssignmentException Error At Registration

Ok, I'm not sure what I'm missing here but when I try to create a new user account I get the following MassAssignmentException error:

MassAssignmentException in Model.php line 448: name

Here is my AuthController

protected function create(array $data)
    {

        $user = User::create([
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            'api_key' => \App\Profile::generateKey()
        ]);

        if(isset($data['stripeToken']) && isset($data['plan'])) {
            if(isset($data['coupon'])){
                $user->newSubscription( 'main', $data['plan'] )->withCoupon( $data['coupon'] )->create( $data['stripeToken'] );
            }else{
                $user->newSubscription( 'main', $data['plan'] )->create( $data['stripeToken'] );
            }
        }

        return $user;
    }

Here is my User model

class User extends Authenticatable
{

    use Billable;
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'api_key', 'email', 'password',
    ];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    public function subscriptions()
    {
        return $this->hasOne('App\Subscription');
    }
}
08 Jan
3 years ago

Presto left a reply on After Commit - Fatal Error: Class 'Dotenv' Not Found

Yeah, uninstalling and reinstalling the repository fixed the issue.

Presto left a reply on After Commit - Fatal Error: Class 'Dotenv' Not Found

No go, did not work :( I may just uninstall the repository, that is a pain, blah!