Member Since 3 Years Ago

Experience Points 4,680
Experience Level 1

320 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 28
Best Reply Awards 0
Best Reply
  • 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.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    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.

30 Oct
1 year ago

toneee started a new conversation Scan For Untranslated Text

Can anyone recommend a plugin or third party application that can scan my laravel application and write any untranslated keys out to JSON files?

I am currently moving to the JSON approach and want to make sure I have captured everything.

Thanks in advance for any replies!

07 Jun
2 years ago

toneee left a reply on Blade Check If Variable Is In Array

Didnt even think of that...Thanks guys, think it was another one of those problems ive spent too long looking at when there was a simple answer!

toneee started a new conversation Blade Check If Variable Is In Array

Hi All,

I am a little stuck with a blade template, I need to check if a variable is in an array, how would I do this? The array can vary in length. If the value is found in the array I need to output a string.


06 Apr
2 years ago

toneee started a new conversation Access API On Homestead Site

Hi All,

I am creating multiple apps using Homestead, I now am at a point where I need one application to access another applications API on the same site, but I am struggling to get it to work.

Does anyone have any docs or information on setting this up. access api on

But app1 cant resolve the url for app2. I thought it might be as easy as setting up the /etc/hosts file, but this doesnt seem to work either.

Thanks for any help!

30 Mar
2 years ago

toneee started a new conversation API For Other Applications


I am writing an app that needs to provide an API to other applications to search, view etc My question is how do I create an API authentication method for applications rather than for users?

Thanks for any help :)

23 Mar
2 years ago

toneee left a reply on How To Add Chart.js To Laravel

Sorry my mistake, i was searching for something else, got confused. The link for anyone else:

toneee started a new conversation How To Add Chart.js To Laravel

Hi All,

I have added chart.js via

npm install chart.js --save

and it apears in the node_modules directory, but how to I include that in my project so it gets compiled when I run

npm run dev


20 Feb
2 years ago

toneee started a new conversation CRUD Application With Seperate Page For Update

Hi All,

I am writing an simple CRUD application and I am stuck on the Update part.

Basically I want to redirect a user to an edit page, but I am not sure how to load the data from the API. I have some javascript to load all the records on the list page which is called on the mounted() function. I am not sure how to load a single record as the mounted function already has an action. Should I split it into seperate javascript? I can get it to work if I load it via a modal window on a button click, which can call the single record function directly.

Here is my current javascript.

Vue.component('task', {
    props: ['user'],

    // el: '#test',

    data() {
        return {
            tasks: [],

            form: new SparkForm({
                name: ''

    mounted() {

    methods: {
        getTasks() {
                .then(response => {
                    this.tasks =;

        getTask() {
            axios.get('/api/task/' +
                .then(response => {
                    this.tasks =;

        create() {
  '/api/task', this.form)
                .then(task => {

           = '';

        delete(task) {
            axios.delete('/api/task/' +;

            this.tasks = _.reject(this.tasks, t => ==;


16 Feb
2 years ago

toneee left a reply on Setting Variables

Thanks @andonovn missing "this." on the console line.

toneee started a new conversation Setting Variables

Hi All,

I have been following the Vue tutorials and am trying to get something really simple working, but seem to be missing something.

The process is getting some data via an API request, setting it to a variable and then displaying it in a html page.

Here is my code

new Vue({

    el: '#test',

    data: {
        tasks: []

    mounted() {
        //axios.get('/api/tasks').then(response => console.log(;
        axios.get('/api/tasks').then(response => this.tasks =;

The first commented out line works, it logs the data to the console, the problem arises when I try to set the tasks variable, it doesnt seem to get set. and the last line console.log shows an error as the variable isnt set.

Hope someone can help as I am sure its something simple I am missing.


13 Feb
2 years ago

toneee left a reply on Simple Application Tutorials

So I have started from the beginning and gone through the tutorial for spark again. It all makes sense. When I get to the API part I just can not make it work.


Vue.component('home', {
    props: ['user'],

    ready() {
            .then(response => {


    'middleware' => 'auth:api'
], function () {

    Route::get('/test', function() {
        return ['name' => 'John Smith'];

I then refresh the page and dont get any console output. What am I missing?

toneee left a reply on Simple Application Tutorials

Hi @Ftoi, I have but I would like an example of adding some sort of form data, posting to DB and reading out in the correct way.

toneee started a new conversation Simple Application Tutorials


Are there any simple Spark tutorials to create simple applications? I have taken a look at the demo app, but it isnt clear to me how it all hooks together.


19 Jan
2 years ago

toneee started a new conversation Stripe Billing Quantities

I am working through updating some of the billing in my application and have got a little stuck.

A user can buy 3 levels:

  • Bronze - Discount 0% - Quantity 1
  • Silver - Discount 10% - Quantity 5
  • Gold - Discount 25% - Quantity 10

If you assume 1 quantity is an email account that is active for that month.

I have 1 plan which is $10 and then its worked out with the quantity

  • Bronze is ($10 * 1qty) - 0% = $50
  • Silver is ($10 * 5qty) - 10% = $45
  • Gold is ($10 * 10qty) - 10% = $75

I understand that the first bill gets paid and discounted as soon as the subscription is selected.


When I used the updateQuantity it changes the quantity to the new one and prorates the cost but does not charge straight away. This will be prorated in the next billing cycle along with the next months billing at the new quantity.

The part i get stuck around is how do I check how many quantity (email accounts) can be active during the month. If i check the quantity in the db it will only show the updated quantity so if you move from bronze to silver it will show a quantity of 5, but in reality I should be able to have 6 as I have already paid for 1 active upfront, then at the end of the billing cycle for that month it should drop to 5.

This is more of an issue when a customer wants to downgrade and I am really not sure how to handle this.

I hope someone can help and I have explained it well enough :) Thanks!

toneee left a reply on Requests & Rules

@jlrdw its in two forms just for form seperation I guess, I dont want to submit name and email if all I want the user to do is update the profile picture and vice versa.

@ksungcaya this is a link back to this discussion?

18 Jan
2 years ago

toneee started a new conversation Requests & Rules

Hi All,

I am currently undertaking a task on my project to make sure all validation rules are correct and up to date. I have decided to move all rules into FormRequest. I have read the documents and have got a bit stuck and need some help.

Basically I have a profile page that has 2 forms

Form 1 is to update the profile photo Form 2 is to update name and email address

This is my ProfileRequest.php


namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ProfileRequest extends FormRequest
     * Determine if the user is authorized to make this request.
     * @return bool
    public function authorize()
        return true;

     * Get the validation rules that apply to the request.
     * @return array
    public function rules()
        return [
            'profile_picture' => 'image|mimes:jpeg,png,jpg|max:2048',
            'name' => 'required|string|max:255',
            'email' => 'required|unique:users|email',

The point at which i get stuck is if I update only the profile picture i get an error because of the name and email already being in the database with their current values. How do I add rule validation into this file to eliminate this issue? It is the same if I only update the name it errors on the email field and vice versa.

Thanks for any help!

12 Dec
2 years ago

toneee left a reply on Collections On Data

Damn it! Why oh why did I think putting the collection on the array was a good idea!

Thanks you solved it!

11 Dec
2 years ago

toneee started a new conversation Collections On Data

Hi All,

Im after some help as I am a little confused on the best way to do something and think I have been looking at it so long that has caused more problems :)

So essentially I want to store some data in an array (Havent put in the DB as I dont think its worth it as it will stay pretty much static, but I dont want to hard code it as it will be used in various places and may change at a later date.)

I have created this:


namespace App\Http\Utilities;

 * Account Detail class
class accountDetail

    protected static $accountdetails = [
            'user' => ['name' => 'user',
                       'color' => 'green',
            'manager' => ['name' => 'manager',
                          'color' => 'blue',
            'admin' => ['name' => 'admin',
                        'color' => 'red',

    public static function all()
        return static::$accountdetails;

so I call:

$accountdetails = accountDetail::all();

and it works fine, it gives me an array of all the details, but I want to be able to do things like ->first() and other collection methods, but for the life of me I cant work out how to change it so it work, or to be fair if this is a crap way to handle information like that?

Any help or critique is appreciated!

07 Nov
2 years ago

toneee left a reply on Finding The Issue

lol 1 hour of logins is a lot of logins... :)

toneee left a reply on Finding The Issue

1 hour of my life wasted and found the issue...

// This is the admin.

All to make my life easier so I dont have to login whilst developing.

Commented it out and migrations now run.

toneee left a reply on Finding The Issue

There isnt a DB as I have run php artisan migrate:rollback which destroyed the table.

Although when I ran php artisan migrate:refresh it worked because it didnt destroy the table.

Its pretty much this issue here:

I just cant find what is causing the issue.

toneee left a reply on Finding The Issue

Have done that too, i am 100% positive its an error in the code.

toneee left a reply on Finding The Issue

Yep its all correct. .env is all good. I think its something along the lines of some security I have started to implemented that looks up the tables before it runs anything and for some reason artisan runs this code every time. Just cant seem to put my finger on where it is.

toneee started a new conversation Finding The Issue

Hi All,

I have just come back to working on one of my projects and have started up vagrant and about to run a migrate command to fill up the DB but have hit an issues:

[email protected]:/projects/$ php artisan migrate                                                                     
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'homestead.users' doesn't exist (SQL: select * from `users` where  `users`.`id` = 1 limit 1)                                                                                                     
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'homestead.users' doesn't exist 

none of the php artisan commands work and always display this error. I know that this will be something in my code, but for the life of me I cant figure out where it is or how to give a more informative error message.

Any help would be appreciated! Thanks.

28 Sep
2 years ago

toneee left a reply on Parse JSON Returned In An Error From A Form

So I have managed to find a work around, not sure if it is the correct method, but it works.

Turns out it was javascript escaping the data passed to it.

Essentially when the form fails to submit the errored data is added back to the hidden input field and then javascript reads it from there...

HTML Form:

<input name="post" id="post" type="hidden" data-post-id="{{ old('post') }}">


var postId = $('#post').data("post-id");

A bit like this post: blade-javascript-and-variables

27 Sep
2 years ago

toneee left a reply on Parse JSON Returned In An Error From A Form

So quill works by using js to pass the data that is in the form to a hidden input field, then the form i submitted as normal.

Quill Submit JS

var toolbarOptions = [
  ['bold', 'italic', 'underline'],        // toggled buttons
  [{ 'list': 'ordered'}, { 'list': 'bullet' }],
  [{ 'indent': '-1'}, { 'indent': '+1' }],          // outdent/indent
  [{ 'header': [1, 2, false] }],
  ['clean']                                         // remove formatting button

var quill = new Quill('#editor', {
  modules: {
    toolbar: toolbarOptions
  placeholder: 'Compose an post...',
  theme: 'snow'

var form = document.querySelector('form[name=form]');
form.onsubmit = function() {
  // Populate hidden form on submit
  var description = document.querySelector('input[name=post]');
  description.value = JSON.stringify(quill.getContents());

  //console.log("Submitted", $(form).serialize(), $(form).serializeArray());

 // alert('Open the console to see the submit data!');
  return true;



<input name="post" type="hidden">
  <div class="col-sm-6">

  <!-- Editor container -->
  <div id="editor">
    <p>{{ old('post') }}</p>
  @if ($errors->has('post')) <p class="help-block">{{ $errors->first('post') }}</p> @endif

toneee started a new conversation Parse JSON Returned In An Error From A Form


I have implemented Quill in a form.

The form submits fine using Requests (extending FormRequests) for validation. If the form has an error (e.g. a field not filled in it returns back to the form with the old values added to the inputs. Apart from the quill editor entry which when submitted converts the input to JSON and submits it, so when the form errors it returns the JSON string to the blade template, rather than the formatted text.

Does anyone know how to parse this in the blade template or is there another way to do this to fix this error?

Submitted data returned to blade:

{"ops":[{"insert":"test description\n"}]}
16 Sep
3 years ago

toneee left a reply on Shared Database Between 2 Applications

@ctomasz That is an excellent idea! I hadnt even thought about that.

toneee left a reply on Shared Database Between 2 Applications

@martinbean, Thanks for the reply, maybe I should have been a little more specific :)

So each application will have access to their own database, but then I need application 2 to access a table in application 1 database whilst still maintaining access to its own database.

toneee started a new conversation Shared Database Between 2 Applications

Hi All,

As always after a bit of advice, I have been developing an application for a couple of months now and have started to come to the realization that maybe I should separate it into two different applications.

I think splitting it out will have a number of benefits

  • Faster time to getting something live.
  • Keeping application logic in each application.
  • Maintenance will become easier as I can work on and update/upgrade each individual application rather than entire application downtime.
  • I can potentially farm out development of one of the applications.
  • If one part of the application becomes more successful I can phase the other part out without having to refactor a lot of code.

The one questions I have is around database access, for example there will be one table that will need to be accessed from each application. Read/Write in one application and only Read on the other. Is this shared access possible with Laravel?

From an infrastructure point of view I know I can do this by replicating the data in MySQL, but this is a little clunky.

Any advise would be useful! Thanks!

13 Sep
3 years ago

toneee left a reply on Best Method For Multi Auth In Spark?

@martinbean , Thanks for your thoughts and its pretty much the same thought process I have gone through. So it would be acceptable to have something like

User tables

userid - User ID

Seller profile table

sellerid - profile ID
userid - foreign key to users table
custom seller profile info...

Buyer profile table

buyerid - profile ID
userid - foreign key to users table
custom buyer profile info...

Then use a join to link the user to their profile.

09 Sep
3 years ago

toneee started a new conversation Best Method For Multi Auth In Spark?

Hi All,

I am currently writing an app in Laravel 5.2 and have configured multi auth so that users and customers have two different tables etc.

I am thinking about moving over to spark as it has 100% of the features I have been writing in laravel already built. I am only about 50% of the way though building those features at the moment.

My question is around multi auth for these two distinct user types/groups. Is it better to stick with single auth but then separate into different roles and then have another table for customer and users with a user_id foreign key and just join them or recreate the multi auth setup I currently have?

Any thoughts on both solutions?


07 Sep
3 years ago

toneee started a new conversation UI Questions

Hi All,

I am after a bit of advice. I am currently using Sweet Alert for alerting in my app. I have going to a point where I am updating a set of data and it throws up a big success message. Whilst I loved this to start off with I am finding it a bit annoying when I update 2 fields and it would be good to have a green success session flash above the fields that have been updated rather than just a big generic success alert.

Do you think from a design perspective it is ok to mix session flash messages and sweet alert messages or should I pick one and use it throughout.

Thanks in advance!

29 Jul
3 years ago

toneee left a reply on Missing Something Simple With Eloquent

Thanks Tomi! I spent far too long staring at this and missed it.

So I actually had

$admin = App\Admin::findOrFail(1);

The error was in this part

\\ wrong (mine)
            'title' => $request->title,
            'body' => $request->description,
\\ correct (yours)
$post = $admin->jobs()->create([
            'title' => $request->title,
            'body' => $request->description,

toneee left a reply on Missing Something Simple With Eloquent

Thanks Tomi, I have but still cant see what ive got wrong...

toneee started a new conversation Missing Something Simple With Eloquent

Hi All,

I am having a problem with my eloquent setup. I have created a separate authentication provider which works fine, I can CRUD, Login, Password Reset users to a different table. My problem is I am trying to save a post against this user using

            'title' => $request->title,
            'body' => $request->description,

I get this error:

BadMethodCallException in Macroable.php line 81: Method admin does not exist.

and for the life of me I cant see why, I know its something simple and I have probably spent too long looking at it to see it now.


class Post extends Model
        // a post is owned by an admin
        public function admin()
            return $this->belongsTo('App\Admin');
class Admin extends Authenticatable
    // a recruiter can have many jobs
    public function posts()
        return $this->hasMany('App\Post');
05 Jul
3 years ago

toneee started a new conversation Should I Move My Project To Spark?

Hi All,

I am after some advice about if I should move my project to Spark from the Base/Standard Laravel?

  • Is it advised/secure to run production applications with Spark?
  • Is it possible to setup multi-auth Spark? (I currently have 2 different types of users authenticating to 2 different databases. Users goes to users.doman.tld and Admins go to admins.domain.tld. I know this is routing and simple, but setting up to use different auth guards was a pain, until it finally clicked. How easy is this to setup with spark and is there a tutorial?)

Hope someone can answer my questions and give some advice before I start to migrate move my part written application to Spark.


01 Jul
3 years ago

toneee started a new conversation Multi Auth Route Binding


I have setup a couple of extra authentication guards to use multi auth in Laravel 5.2.

I am trying to use route binding to save a task against user in one of these guards.

trying the below code doesnt work

    public function test(Request $request, Admin $admin)
        return $admin;

yet trying this does

    public function test(Request $request)
        return Auth::guard('admin')->user();

what am i missing?

03 May
3 years ago

toneee left a reply on Auth::attempt Fails Every Time

Hi All,

Thank you all for your help, but it turns out this is my own stupidity, I also realised that if i explained my entire setup you excellent people would have spotted this a while ago :(

So just to go into a bit more detail on my app. I have multi authentication setup with different guards and different user tables.

Essentially Laravel was working perfectly, it was doing what it was supposed to, only problem i didnt tell it the correct table/guard to use. I added the guard method and it now works.

protected $guard = 'web_moderators';
dd(Auth::guard($this->guard)->attempt($request->only('email', 'password')));

I am sorry, but really appreciate your help on trying to help me sort this out.

toneee left a reply on Auth::attempt Fails Every Time

Hi All,

Sorry for the late reply, work always seems to get in the way :)

@Prez , I have tried with the route and dd you mentioned with an incorrect account i get false (expected result), i tried with a correct account and i get false.

This worked fine before I tried to implement a custom authentication function. I am trying to implement another check which is along the lines of "status = enabled", but thought I would just get the basics working first before adding onto it. So I know the password storage is correct, its something to do with the password being passed to the authenticate function, does it need to be hashed? or is there another method to check the 2 passwords against each other?

Thanks again.

02 May
3 years ago

toneee left a reply on Auth::attempt Fails Every Time

Hi All,

So this is the code I used to create the user:

    protected function create(array $data)
        $user = User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),

        return $user;

toneee started a new conversation Auth::attempt Fails Every Time


I am trying to write a custom auth controller, but am having problems with the Auth::attempt part of a login. I have the default database setup and names. I think its a problem with the hashing of the password, but apparently this should happen automatically with the Auth::attempt function?

Here is my class, can anyone help please?

public function authenticate(Request $request)
    if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
        echo "Login OK";
    else {
        echo "Login Failed";
16 Mar
3 years ago

toneee left a reply on Multi Auth Example

Isnt gate more for ACL?

toneee started a new conversation Multi Auth Example


I need to create multiple user types for an application I am building, with individual registration and login pages.

Originally I started by creating a role entry in the database, but the application has outgrown this and I need to store different user data.

I want to use Multi Auth in Laravel 5.2 but am struggling to find a good tutorial / example on how to do this. Does anyone know of one at all?


15 Mar
3 years ago

toneee started a new conversation Please Delete


14 Mar
3 years ago

toneee left a reply on Accessors With Dates?

Ah found the man page for this:

is %a - Total number of days as a result of a DateTime::diff() or (unknown) otherwise

toneee left a reply on Accessors With Dates?

Hi @tykus_ikus,

Thanks thats what I was after, I must have missed it in the docs :(

One last thing, Do you know how i would increment the days if its over 31 rather than having to add $m months?

Thanks again for your help!

toneee left a reply on Accessors With Dates?


Thanks for the reply and I have it working now, but its not exactly giving me the output I am after.

I really want it to output something like "10 days, 5 hours and 38 minutes left" and I think diffForHumans cant do this to a sufficient level. Unless I am mistaken.

I also need to it to check against now() rather than start_date.

class MyModel {

    protected $dates = ['start_date','end_date'];
    public function getRemainingTimeAttribute()
        return Carbon::now()->diffForHumans($this->end_date);
13 Mar
3 years ago

toneee started a new conversation Accessors With Dates?


I hope I am looking at the right area and not barking up the wrong tree.

Essentially I have two datestamp fields (Date and time, YYYY-MM-DD HH:MM:SS) in my database and I want to work out the difference between the two dates.

From what I have read I can do this with an accessor and then pass the value with the rest of the array to the blade template for a view. Is this correct and how would I accomplish this? I want to get to a point where I can output "You have 2 days, 3 hours and 47 minutes left" message, rather than just outputting the two datestamps if that clears up any confusion or miss explanation.

Hope someone can help & Thanks!

11 Mar
3 years ago