at Home

Member Since 1 Year Ago

Cape Town

Experience Points

4,230 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
Best Reply Awards
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.

Level 4
15,770 XP
6 days ago
Activity icon

Replied to Eloquent Create And Axios Vuejs Post Request Does Not Save File And Save Other Records With Error

Yes, you are right, and I also accept your suggestion. And my final refactored code looks like this:

public function createProjectTask(Request $request, Project $project) {
    $task = Task::create($request->except(['file']));

        $fileName = $request->file->getClientOriginalName();
        $request->file->move(public_path("tasks/{$task->id}"), $fileName);
        $task->fill(['file' => $fileName]);
    return $task;
Activity icon

Started a new Conversation Eloquent Create And Axios Vuejs Post Request Does Not Save File And Save Other Records With Error

My route looks like this:

Route::post('task/project/{project}/save', '[email protected]');

The method in the controller looks like the following:

public function createProjectTask(Request $request, Project $project) {
    $input = $request->all();
    $task = Task::create([
        'project_id' => $request->project_id,
        'owner_id' => '3',
        'name' => $request->name,
        'description' => $request->description,
        'summary' => $request->summary,
        'duration' => $request->duration,
    if(empty($input['file'])) {
        $fileName = $request->file->getClientOriginalName();
        $request->file->move(public_path("tasks/{$task->id}"), $fileName);
        $task->fill(['file' => $fileName]);
    return $task;

I use axios to execute the post request inside a vuex action and it looks the following from the vue side:

In the vue template, I have the function that gets the file data in case a file is selected, and then I have the submission of the form:

onFileChange(e) {
    this.task.file =[0]


    var formData = new FormData();
    formData.append('project_id', this.projectId)
    formData.append('description', this.task.description)
    formData.append('summary', this.task.summary)
    formData.append('duration', this.task.duration)   
    if(this.task.file != ''){
        formData.append('file', this.task.file)

    const taskData = {
        formData: formData,
        projectId: this.projectId

    this.$store.dispatch('addProjectTask', taskData)


addProjectTask is the action and looks like the following:

addProjectTask({commit}, taskData) {'/task/project/' + taskData.projectId + '/save', taskData.formData)
    .then(res => {
        console.log("New task added")
    .catch(err => console.log(err))

I noticed two things: 1 - the file is not saved at all. 2 - i try to save the data without an image, in the console, i get a 500 internal server error, but if i visit the database, the record actually gets added.

How can I save the records with or without image and not have the internal server error?

1 week ago
Activity icon

Started a new Conversation I Get An Error When I Try To Access A Property Of A Nested Object

My request in the vue side looks like this:

axios.get('/api/project/' + this.$
.then(res => {
    this.project =
.catch( err => console.log(err))

If I console.log "this.project" I get the project with its related owner details, like so:

project: {
    id: 1
    owner: {
        name: 'my name comes here'

In the template, I want to display the owner, as well as the the name of the project and I do it like this:

 <p>{{ }} | {{ }}</p>

The owner name shows, however, I notice the following error/warning in the console:

[Vue warn]: Error in render: "TypeError: Cannot read property 'name' of undefined"

If I remove the "", the error disappears.

Why does it show the owner name but it says undefined at the same time? The same is happening for all other properties that are nested inside other objects.

1 week ago
Activity icon

Started a new Conversation How Can I Download A File In Laravel And Vuejs

I initially created a route that allows a user to download a specific file, which works perfectly fine.

Route::get('project/{project}/download', '[email protected]'); 

public function downloadFile(Project $project){
    return response()->download(public_path() . "/upload/WhatsApp Image 2019-10-31 at 19.57.15.jpeg");

When I hit the url, the download happens.

How can I do the same via vuejs?

I tried using that end point inside the component but it doesn't download the file.

The component looks like this:

    <button @click="download" class="btn btn-primary">Download file</button>

    export default {
        methods: {
                    url: '/project/1/download',
                    method: 'GET',
                    responseType: 'blob',
                .then((res) => console.log(
                .catch(err => console.log(err))

When I hit the download button, I see the following in the console

BlobĀ {size: 73561, type: "image/jpeg"}

and file does not download.

How can I download a file using laravel and vuejs?

2 weeks ago
Activity icon

Started a new Conversation How Can I Controller My Web Routes From Vuejs Except A Specific Prefixed Route?

I created a few resources and the controller looks like this:

    Route::resource('projects', 'ProjectController');
    Route::resource('tasks', 'TaskController');

So, those are the end point that I want to access on the vue.js side.

If I hit the url: site.example/compnay/tasks, I see the response.

Next, I added the following to my web routes under the intention of having my routes rather managed on the vue side:

Route::get('/{any}', '[email protected]')->where('any', '.*');

But, after adding that, if I hit site.example/compnay/tasks I no longer see the desired response I had seen previously, but the App Component content, which looks like this:

    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">Example Component</div>

                    <div class="card-body">
                        I'm an example component.

    export default {
        mounted() {
            console.log('App component mounted.')

And this is how my app.js looks like this:


import Vue from 'vue'
import App from './App.vue'

Vue.component('app-component', require('./components/MainComponent.vue').default);

new Vue({
    render: h => h(App)

How can I controller the routes via vue.js, but still be able to see the response from all the routes under the company prefix? So if I hit site.example/company/tasks, I am able to see the json response.

1 month ago
Activity icon

Commented on Building The World


2 months ago
Activity icon

Started a new Conversation My Valet Installation Does Not Pink And Brew Services Don't Run Properly

Am having a hard time to run laravel projects on a mac.

After installing homebrew, I ran the following commands:

brew update

brew install php

When I run brew services list, I see the following:

Name    Status  User   Plist
mariadb stopped
mysql   started sidney /Users/sidney/Library/LaunchAgents/homebrew.mxcl.mysql.plist
php     error   root   /Library/LaunchDaemons/homebrew.mxcl.php.plist

composer global require laravel/valet

valet install

When I try to ping: ping test, it takes a few seconds, and then I see this message:

ping: cannot resolve foobar.test: Unknown host

Troubleshooting further, I ran the following commands and saw the respective results:

Sydney-de-Sousas-Mac:~ sidney$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
Sydney-de-Sousas-Mac:~ sidney$ brew link mariadb
Linking /usr/local/Cellar/mariadb/10.4.6_1... 197 symlinks created
Sydney-de-Sousas-Mac:~ sidney$ brew services list
Name    Status  User   Plist
mariadb stopped
mysql   started sidney /Users/sidney/Library/LaunchAgents/homebrew.mxcl.mysql.plist
php     error   root   /Library/LaunchDaemons/homebrew.mxcl.php.plist
Sydney-de-Sousas-Mac:~ sidney$

How do I successfully install valet and run laravel projects using it?

My system version is 10.13.6 - High Sierra

2 months ago
Activity icon

Started a new Conversation How Do I Format Json Data From Api Call?

My snippet looks like this:

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "[email protected]",
    "Accept: */*",
    "Authorization: Bearer thetoken",
    "Cache-Control: no-cache",
    "Connection: keep-alive",
    "Content-Type: application/x-www-form-urlencoded",
    "accept-encoding: gzip, deflate",
    "cache-control: no-cache",

$response = curl_exec($curl);
$err = curl_error($curl);


return $response;

The response shows me an object like this:

    success: true,
    count: 1,
    data: [{
       id: 3429217,
       brand_id: 2323,
       first_name: "My name",

First: Instead of return the entire JSON, how can I return only the data inside the data key? Second: What would be the best way to do this API call?

2 months ago
Activity icon

Replied to I Get An Access Denied When I Try To Access My Database After Installing Valet

Right now, I closed all the terminals and re-opened. If I type "mysql", I managed get into the server, but if I try to create a database then I get access denied.

If I exit and try to enter using mysql -uroot I also get access denied as before

Activity icon

Started a new Conversation I Get An Access Denied When I Try To Access My Database After Installing Valet

Am currently migrating to mac OSX and I want to use valet for my laravel sites. So here is where I got stuck:

After installing homebrew, PHP and the rest of the requirements that valet needs, when I got to my terminal, I can't access my database.

At first, I had this:

Sydney-de-Sousas-Mac:~ sidney$ mysql -uroot
mysql: Can't read dir of '/usr/local/etc/my.cnf.d' (OS errno 2 - No such file or directory)
mysql: [ERROR] Fatal error in defaults handling. Program aborted!
Sydney-de-Sousas-Mac:~ sidney$ mysql server start
mysql: Can't read dir of '/usr/local/etc/my.cnf.d' (OS errno 2 - No such file or directory)
mysql: [ERROR] Fatal error in defaults handling. Program aborted!
Sydney-de-Sousas-Mac:~ sidney$ mysql
mysql: Can't read dir of '/usr/local/etc/my.cnf.d' (OS errno 2 - No such file or directory)
mysql: [ERROR] Fatal error in defaults handling. Program aborted!

Then I created the file it requested:

Sydney-de-Sousas-Mac:~ sidney$ mkdir /usr/local/etc/my.cnf.d

But I get access denied when I try to access my DB

Sydney-de-Sousas-Mac:~ sidney$ mysql -uroot
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Sydney-de-Sousas-Mac:~ sidney$ mysql -uroot -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I thought that by default the password is an empty string.

How do I access my database?

Activity icon

Started a new Conversation How To Fix 302 Too Many Redirects

I have a website with multisite set to true.

I can see all the pages regardless of the language, however, If I am on the dashboard, and hover over my sites, I cant see any of the dashboards of the other languages.

After a few seconds a see an error that says too many redirects.

If I inspect the page and view the network tab, I see a 302 error.

I have this in my configuration:

define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false); // Set to false if you selected the "Sub-directories" installation.
define('DOMAIN_CURRENT_SITE', 'localhost');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

// Authentication unique keys and salts
 * @link secret-key service 
define('AUTH_KEY',         'i7a3cyhnq7r89qtnr87639nf70wq3tyy0w9fny089q3fyw78yn0987fcwy890');
define('SECURE_AUTH_KEY',  'io7scyo7fystyf98st86rcts6er7te67ctsert676erctse7r6ts76etv76tr');
define('LOGGED_IN_KEY',    'ij8sddufs8yf657s4c57sfrt8697rf9fn89jsu094s8uf09488us4f089yu0v');
define('NONCE_KEY',        'sdaf8yv65643v5ft68suvs9cu9p0w349u90-48u489wy98fu984f98euf9889');
define('AUTH_SALT',        '9z08jxe6h789mn8b67c8n7xm893n280n7c4mx9cn749mx89cn78438m02n9c7');
define('SECURE_AUTH_SALT', '21333333333780v465bn87b698n7ewc8n48fu848c4mncf4u84wfcum84f4cw');
define('LOGGED_IN_SALT',   'yr5bt3268mu30mu89248mufxy79ny79x9m89u2mu892dxm8u9d2xmu89dx298');
define('NONCE_SALT',       '4e6r57t8yz9u80t6y79n8b6t7rzmy890nxg8zhm0x79gnhmz280gx7989898y');

// Custom settings
define('WP_AUTO_UPDATE_CORE', false);
define('DISALLOW_FILE_EDIT', true);
define('WP_DEFAULT_THEME', 'themosis-theme');

Inside the htaccess I have this:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) cms/ [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ cms/ [L]
RewriteRule . index.php [L]

Options -Indexes

I noticed that there a several question on the web about the same issue, which didn't resolve my issue, so I thought best to also post what I currently have in my users table:

MariaDB [theme]> select * from wp_options limit 10;
| option_id | option_name        | option_value                 | autoload |
|         1 | siteurl            | http://localhost/cms         | yes      |
|         2 | home               | http://localhost             | yes      |
|         3 | blogname           | Themename                | yes      |
|         4 | blogdescription    |                              | yes      |
|         5 | users_can_register | 0                            | yes      |
|         6 | admin_email        | [email protected] | yes      |
|         7 | start_of_week      | 1                            | yes      |
|         8 | use_balanceTags    | 0                            | yes      |
|         9 | use_smilies        | 1                            | yes      |
|        10 | require_name_email | 1                            | yes      |
10 rows in set (0.00 sec)

NOTE: The site was installed with docker, so the file structure does not look exactly the same like in regular WordPress sites.

From the root directory, my site sits under htdocs/content/themes/themename

To login to the main dashboard, I type: localhost/cms/login

MORE INFO: This is a WordPress site that uses themosis framework, which is based on Laravel, however, during all this time I am spedning to try to fix this, I noticed that this is very likely to do with the htaccess. As a matter of fact, If I inspect my network tab, I see a 302 error that fires of about 8 times.

How can I view the dashboard for the other languages?

3 months ago
Activity icon

Replied to How Do I Set An End Point With An Array Of Values

I just updated my question.

Activity icon

Replied to How Do I Set An End Point With An Array Of Values

I still get the exact same error and am almost sure that the issue is in the js side when I do this:

let order = =>;

axios.get('api/list/order/' + order)
.then(res => console.log(
.catch(err => console.log(err));

it seems like the url is not receiving the order from "let order" as an array.

Activity icon

Started a new Conversation How Do I Set An End Point With An Array Of Values

I used localstorage to save the product id of every product that is added to the cart.

Then I have a button called "View Order". When I click on that button, I want to view details of each product that has been added to the cart such as the title, description, image and be able to update the quantity.

The view order button calls a function which looks like the following:

    if (localStorage.getItem('order')) {
        try {
            this.order = JSON.parse(localStorage.getItem('order'));
            this.$store.dispatch('list_orders', this.order.length);
        } catch(e) {

    const order = =>; //[array of order ids]

    axios.get('api/list/order/', {
        params: {
            order: order
    .then(res => console.log(
    .catch(err => console.log(err));


In web.php I have this:

Route::get('api/list/order/{order?}', '[email protected]_order');

In the OrderController I have this:

public function list_order($order = null){
    if ($order == null) {
        abort(404, 'No order was passed');

    $order = explode(',', $order);
    $orders = DB::table('products')->whereIn('id', $order)->get();

    return $orders;

When I click on view order I see the following error in the console:

VM4305:1 GET http://challenge-shopping.local/api/list/order?order[]=3&order[]=2 404 (Not Found)
3 months ago
Activity icon

Started a new Conversation How Do I Create A Unique Session For A User That Is Not Logged In

For this task, created an end-point that lists all products using VueX and the template has this:

<div v-for="p in products" class="col col-md-4">
    <div><span class="title">{{ p.title }}</span> | <span class="price">R{{ p.price }}</span> </div>
    <p>{{ p.description | counter }}</p>
    <button @click="order" class="add-cart btn btn-primary">Order Now</button>

When I click to order, an order method needs to get fired which will add that particular product into the cart.

methods: {
        //update cart object

However, to proceed to checkout, the user needs to be logged in and am using the laravel auth.

Since the cart details are to be stored in a cart object, the cart details need to be available even after the page refreshes to the login. and I assume I need to have a type of session for as soon as the user enters on the page for the very first time.

How can I achieve this? How can I let the system record the cart details before the user is logged in and remember it even after the page reloads?

Hope the explanation makes sense.