shaqaruden

shaqaruden

Member Since 2 Years Ago

Experience Points 54,090
Experience
Level
Lessons Completed 529
Lessons
Completed
Best Reply Awards 0
Best Answer
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.

19 Dec
4 hours ago

shaqaruden left a reply on Template Or Render Function Not Defined.

@MCSTEPP - This project is not using laravel. I have never had an issue using vueJS with with laravel

18 Dec
1 day ago

shaqaruden left a reply on Template Or Render Function Not Defined.

I left it alone for a bit and just tried again and having

Vue.component('pacerboard', require('./components/PacerBoard.vue').default);

is now working. I guessing it might have been a caching issue even though i had cleared my cache while debugging

shaqaruden left a reply on Template Or Render Function Not Defined.

@REALRANDYALLEN - I am running yarn watch but I also tried yarn dev

shaqaruden left a reply on Template Or Render Function Not Defined.

@AHMEDDABAK - ```javascript let mix = require('laravel-mix'); require('laravel-mix-tailwind');

mix.js('src/app.js', 'public/js') .sass('src/app.scss', 'public/css') .tailwind();

shaqaruden started a new conversation Template Or Render Function Not Defined.

I have started a project from scratch bringing in Laravel Mix, Tailwind, and VueJS.

I created my first component to test

<template lang="html">
    <div>
        <h1 class="bg-green text-blue">Hello World!</h1>
    </div>
</template>

<script>
export default {
    data() {
        return {
            
        }
    }
}
</script>

<style lang="css">
</style>

and registered in in app.js

window.Vue = require('vue');

Vue.component('pacerboard', require('./components/PacerBoard.vue'));

const app = new Vue({
    el: '#app'
});

and then try to display it

<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="css/app.css">
</head>
<body>
    <div id="app">
        <pacerboard></pacerboard>
    </div>
    <script src="js/app.js" charset="utf-8"></script>
</body>
</html>

but I am getting an error when loading the page

[Vue warn]: Failed to mount component: template or render function not defined.

found in

--->

21 Nov
4 weeks ago

shaqaruden started a new conversation Roles Based On AD Group

I am working on an application that allows users to authenticate with ADLDAP2 which i have working. My next task is to to apply access controls. I want users to have access to certain pages based on their AD group.

For example a user that is a member of the IT group has access to the admin dashboard while another user that is a member of the Shipping group has access to shipping related pages but not the admin dashboard.

I am not sure how I should approach this. Any ideas? Has anyone done this before?

08 Nov
1 month ago

shaqaruden left a reply on Variable Changing When Value Of Input Changes With V-model

I figured out my issue. My problem was I was trying to v-model to a prop which of course I shouldn't do.

i created 2 new variables

data() {
        return {
            editing: false,
            name: this.pi.name,
            type: this.pi.type
        }
    },

and reference 'name' or 'type' wherever I referenced 'pi.name/pi.type' in my template

<input class="bg-grey-light p-2 rounded" type="text" v-model="name">

shaqaruden left a reply on Variable Changing When Value Of Input Changes With V-model

Fixed it. Changed

<input class="bg-grey-light p-2 rounded" type="text" v-model="pi.name">

to

<input class="bg-grey-light p-2 rounded" type="text" :value="pi.name">

shaqaruden left a reply on Please Bring Back The Older Laracasts Design

I have already adapted t the new design. I find it more intuitive. The real test for me is can I load it on my shitty linux laptop. The old design did not run well on it at all

shaqaruden started a new conversation Variable Changing When Value Of Input Changes With V-model

I'm working on building a table with inline editing. I created a ItemRow component runs through v-for, here is my whole table

<table class="w-full">
                <thead class="bg-blue text-white">
                    <th class="p-4">#</th>
                    <th class="p-4">Name</th>
                    <th class="p-4">Type</th>
                    <th class="p-4">&nbsp;</th>
                </thead>
                <tbody>
                    <item-row v-for="pi in raspberrypis" :key="pi.name" :pi="pi"></item-row>
                </tbody>
            </table>

In that component in the final column of each row I have 2 buttons 'Edit' and 'Delete' when clicking on 'Edit' the row changes into a inline form with the 'Edit' and 'Delete' buttons being hidden in favor of a save button. This is done by changing the 'editing' variable to true or false and the v-if on all the components to either display or not display based on the state of the 'editing' variable.

<template>
    <tr class="border-b-2 border-grey-light hover:bg-grey-lighter h-12">
        <td  class="px-4">{{ pi.id }}</td>
        <td v-if="editing" class="px-4">
            <input class="bg-grey-light p-2 rounded" type="text" v-model="pi.name">
        </td>
        <td v-if="!editing" class="px-4">{{ pi.name }}</td>
        <td v-if="editing" class="px-4">
            <div class="inline-block relative w-full">
                <select class="block appearance-none w-full bg-grey-lighter border border-grey-light hover:border-grey p-3 pr-8 rounded shadow leading-tight focus:outline-none focus:shadow-outline" v-model="pi.type" required>
                    <option value="1" :selected="pi.type === '1' ? true : false">Video Board</option>
                    <option value="2" :selected="pi.type === '2' ? true : false">Pacer Board</option>
                    <option value="3" :selected="pi.type === '3' ? true : false">Positional Video Board</option>
                </select>
                <div class="pointer-events-none absolute pin-y pin-r flex items-center px-3 text-grey-darker">
                    <i class="fas fa-caret-down"></i>
                </div>
            </div>
        </td>
        <td v-if="!editing" class="px-4">{{ typeTransformer(pi.type) }}</td>
        <td  class="h-12 px-4 flex justify-end items-center">
            <button v-if="editing" @click.prevent="save()" class="p-2 bg-green text-white rounded-lg" type="button" name="button">Save</button>
            <button v-if="!editing" @click.prevent="editing = true" class="p-2 bg-orange text-white rounded-lg mr-1" type="button" name="button">Edit</button>
            <button v-if="!editing" class="p-2 bg-red text-white rounded-lg ml-1" type="button" name="button">Delete</button>
        </td>
    </tr>
</template>

My issue is when I have v-model="pi.name' on the name input field, after hitting any key whether it is backspace or a letter for example the editing variable is flipped to 'false'. Removing v-model and the issue no longer occurs

01 Nov
1 month ago

shaqaruden left a reply on Searching Through An Array Of Objects

@Cronix Thanks for the cleanup. Any idea how I could do pagination?

I'm guessing I would find the total number of pages

let numOfPages = Math.ceil(this.displayedAssociates.length/this.pageSize)
this.totalPages = numOfPages < 1 ? 1 : numOfPages

and then adjust the displayedAssocs array depending on the value of the currentPage

this.displayAssocs= this.associates.slice((this.page - 1) * this.pageSize, this.page * this.pageSize)

and change the current page with a click event on the pagination links

Correct?

shaqaruden left a reply on Searching Through An Array Of Objects

@Cronix Just in case anyone else looks at this and uses the code you provided I had to make a small tweak to get it working.

for (var associate of this.associates) {
                    let searchTerm = this.searchTerm.toLowerCase();

                    if (
                        associate.FIRST_NAME.toLowerCase().indexOf(searchTerm) >= 0
                        || associate.LAST_NAME.toLowerCase().indexOf(searchTerm) >= 0
                        || associate.LAST_NAME.toLowerCase().indexOf(searchTerm) >= 0
                        || associate.LAST_NAME.toLowerCase().indexOf(searchTerm) >= 0
                        || associate.NUMBER.toLowerCase().indexOf(searchTerm) >= 0
                        || associate.DEPARTMENT.toLowerCase().indexOf(searchTerm) >= 0
                        || this.shift_transformer(associate.SHIFT).toLowerCase().indexOf(searchTerm) >= 0
                    ) {
                        this.displayedAssocs.push(associate);
                    }
                }

shaqaruden started a new conversation Searching Through An Array Of Objects

I have created a very rough version of instant search that adjusts the content of a table to the filtered data. I think that the way I have developed to do this is cumbersome and is likely to reveal bugs down the line and I would like to paginate the results as well but at this moment I cannot think of another way to do it.

my array of object is generated by a json request to an api which returns a list of associates with their employee #, first name, last name, department, shift and so on. I have a input that @keyup calls a search method which you can see below.

search: _.debounce(function () {

            if (this.searchTerm == '') {
                this.displayedAssocs = this.associates
                return
            }
            this.displayedAssociates = []
            this.$nextTick(() => {
                for (var associate of this.associates) {
                    if (associate.FIRST_NAME.toLowerCase().indexOf(this.searchTerm.toLowerCase()) >= 0) { this.displayedAssocs.push(associate) }
                    if (associate.LAST_NAME.toLowerCase().indexOf(this.searchTerm.toLowerCase()) >= 0) { this.displayedAssocs.push(associate) }
                    if (associate.NUMBER.toLowerCase().indexOf(this.searchTerm.toLowerCase()) >= 0) { this.displayedAssocs.push(associate) }
                    if (associate.DEPARTMENT.toLowerCase().indexOf(this.searchTerm.toLowerCase()) >= 0) { this.displayedAssocs.push(associate) }
                    if (this.shift_transformer(associate.SHIFT).toLowerCase().indexOf(this.searchTerm.toLowerCase()) >= 0) { this.displayedAssocs.push(associate) }
                }
            });
        }, 200)

Any Ideas?

01 Oct
2 months ago

shaqaruden left a reply on Break Schedule Web App

My question was how to handle the archive of data but after reading your post I thought if there is a date attached to them I can call on that to produce break schedules for previous days.

Thanks for the assistance!

shaqaruden started a new conversation Break Schedule Web App

I hope this is the right place to ask.

So my employer has a break schedule for who is relieving who on each break. Currently they do this by updating an excel spreadsheet and saving it as a PDF, with this there are caching issues which some get the updated schedule and others don't. I would like to change this to be a web app. I am formulating my idea on how I want it to look and function but I can't seems to come up with how to store the data for archiving purposes.

When speaking with a supervisor they requested that it have the ability to recall older schedules from any given day. Each line has 3 breaks which all needs to be stored which could have any number of names(usually 1 - 3 names) and a count 1x,2x,3x (for the number of break relieves the given person will have.

Any ideas on how I could go about storing this data? I will be using Laravel of course.

20 Apr
7 months ago

shaqaruden started a new conversation Update Parent Component

I am trying to create a simple breadcrumb "system" in my Vuetify app. I know that the breadcrumbs are populate based on an array. So this is what I have so far.

I have created a global variable to store my array so all components have access to modify it.

Vue.prototype.$navigation = [ { title: 'Main Menu', to: 'MainMenu'} ]

on the created hook of my pages I am adding to the array and when before the component is destroyed I remove from the array

created: function () {
        this.addToNavigation()
    },
beforeDestroy: function () {
        this.removeFromNavigation()
    },
    methods: {
        addToNavigation: function () {
               this.$navigation.push({ title: 'Scan Asset', to: 'ScanAsset'})

            console.log(this.$navigation)
        },
        removeFromNavigation: function () {
           this.$navigation.pop()
        }
    },

then on my App.vue I am created the breadcrumbs

<v-content>
         <v-breadcrumbs>
            <v-icon slot="divider">forward</v-icon>
            <v-breadcrumbs-item v-for="breadcrumb in this.$navigation" :key="breadcrumb.title" :to="{ name: breadcrumb.to }">
            {{ breadcrumb.title }}
         </v-breadcrumbs-item>
      </v-breadcrumbs>
   </v-breadcrumbs>
   <router-view/>
</v-content>

My issue is my breadcrumb is not updating until the page is refreshed. Is there a better way to handle this? How do I get my breadcrumbs to update?

21 Mar
8 months ago

shaqaruden started a new conversation Use Mix With Vue Electron

I am using the VueElectron vue template and would like to integrate tailwind into the project using the new tailwind plugin for Laravel mix

[https://github.com/SimulatedGREG/electron-vue](ElectronVue Template) [https://github.com/JeffreyWay/laravel-mix-tailwind](Laravel Mix Plugin)

I have installed both mix and the plugin, but not sure how to get them working in the project

14 Feb
10 months ago

shaqaruden started a new conversation Laravel + Forum

I am building a personal video hosting platform based on laravel and I would like to offer a forum as a companion to this video hosting platform. I want user account for the video platform to also work with the forum.

What packages and forum software are available that I could use. I have looked into Flarum but it is no where near ready for prime time.

Any ideas?

05 Feb
10 months ago

shaqaruden left a reply on Method Being Called Before Mounted() Hook?

Sorry really stupid dumb oversight

shaqaruden left a reply on Speeding Up Cache

My issue was not with caching but with displaying the cached data. Rendering 1400+ records from cache into a grid of cards was killing the browser. I simply paginated the cached data into groups on 100 records, this displays almost instantly and I am able to search the entire collection of data as well, which is what I wanted.

26 Jan
10 months ago

shaqaruden left a reply on Method Being Called Before Mounted() Hook?

When I console.log one of my variables in displayData() the console shows

[obj: Observer]

but returns the dataset when called from fetchData()

shaqaruden started a new conversation Method Being Called Before Mounted() Hook?

I am trying to infinite scroll into my project and I have been having an issue with my variables being undefined. after some investigation I found out why.

I have 2 methods one methods fetches data from an API and another that displays the data. I am doing it this way so can search through all the data received from the api easily.

I called the fetchData method on mounted() and the displayData method from a Infinite Scroll Component [Vue Infinite Scroll] (https://github.com/ElemeFE/vue-infinite-scroll)

I added a console.log call to each method and the displayData methods displays it's log message first.

<template>
<div v-infinite-scroll="displayData" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
            <v-progress-linear v-bind:indeterminate="true"></v-progress-linear>
        </div>
</template>
mounted: function()  {
        this.busy = true
        this.fetchData()
        this.busy = false
    },
methods:  {
        fetchData: function() {
            axios.get('http://api.loc/api/associate').then(response => {
                this.associates = response.data.associates
            })
            .catch(e => {
                this.errors.push(e)
            })
        },
        displayData: function() {
            this.busy = true
            console.log(this.associates)
            this.busy = false;
        }
    }
19 Jan
11 months ago

shaqaruden started a new conversation Variables Not In Scope?

I am working on a Vue Electron App and I have a few variables defined

data: () => ({
        associates: [],
        displayedAssociates: [],
        currentDisplayed : 0,
        loading: false
    })

when I try to console.log one of them in one of my method for [Vue Mugen Scoll() they return undefined?

displayData: () => {
        console.log(this.displayedAssociates)
            if (!this.displayedAssociates == []) {
                currentDisplayed = this.displayedAssociates
            }
            data = this.associates.slice(currentDisplayed, 20)
            this.displayedAssociates.concat(data)
            console.log(currentDisplayed)
        }

Here is all my code minus anything not needed

<template>
    <v-layout row wrap>
        <v-flex xs12 md4  v-for="associate in displayedAssociates" :key="associate.number">
            
        </v-flex>
        <mugen-scroll :handler="displayData" :should-handle="!loading">
              loading...
            </mugen-scroll>
    </v-layout>
</template>

<script>
import axios from 'axios';
import MugenScroll from 'vue-mugen-scroll'

export default {
    name: 'Associates',
    created: function()  {
        this.fetchData('http://api.loc/api/associate')
    },
    methods:  {
        fetchData: function(url) {
            this.loading = true
            axios.get(url).then(response => {
                this.associates = response.data.associates
            })
            .catch(e => {
                this.errors.push(e)
            })
            this.loading = false
        },
        displayData: () => {
            if (!this.displayedAssociates == []) {
                currentDisplayed = this.displayedAssociates
            }
            data = this.associates.slice(currentDisplayed, 20)
            this.displayedAssociates.concat(data)
            console.log(currentDisplayed)
        }
    },
    components: { MugenScroll },
    data: () => ({
        associates: [],
        displayedAssociates: [],
        currentDisplayed : 0,
        loading: false
    })
}
</script>

<style scoped>
</style>

shaqaruden left a reply on Using Vue-infinite-loading

Not sure if you figured this out yet but take a look at this.

[https://github.com/egoist/vue-mugen-scroll] (Vue Mugen Scroll)

13 Jan
11 months ago

shaqaruden started a new conversation Speeding Up Cache

I am currently caching data from my API with WebStorageCache Now it is still taking a second or two to assign the data in the cache to a variable on my Vue component. I understand that when loading the 1400+ record object from cache will take time.

My question is how could I speed this up?

##My Thoughts

I know I can paginate the data coming from my API which I do have but currently have it disable because I don not know how I should go about caching it in a logical way.

Would I create separate caching objects for each paginated object returned from the API? Could that all be searchable?

Would I append to 1 cache object? How would I keep track of what has already been cached without making an axios call?

shaqaruden left a reply on Vuetify | Browser Tab Hangs When Using SessionStorage

I fixed the issue before I got to looking at your reply. I ended up pulling in WebStorageCache

Using this my app performs much better. It still is not where I would like it. I disabled pagination on the API while I worked on this because I was not sure how I would handle caching sections of data. ( Caching each paginated result in a separate cache? Append to the cache?)

Here is my working code using WebStorageCache.

import WebStorageCache from 'web-storage-cache'

....

renderData (url) {

        var cache = new WebStorageCache();

        if (!cache.get('people')) {
            axios.get(url).then(response => {
                cache.set('people', response.data.people, {exp : 120});
            })
            .catch(e => {
                this.errors.push(e)
            })
        }
        
        this.associates = cache.get('people');
      }

Even after caching the page takes a second or two to retrieve from localStorage which I would like to remedy.

shaqaruden started a new conversation Vuetify | Browser Tab Hangs When Using SessionStorage

I am trying to cache data from an API. With this specific request the API is returning 1440+ records which comes to around 600kb of data. I have this request wrapped in an if statement checking whether the data has been cached.

From look at the network tab in dev tools I can see that the request complete getting a status code 200 and receiving 626KB and I can check under Application/Session Storage/localhost:8080 and see the cached data but the sites doesn't not display the data like it should. If I navigation away from that page and back the tab hangs and eventually displays blank elements where the data should be.

Here is my code that handles the Session Storage

if (!sessionStorage.people) {
              axios.get(url)
                .then(response => {
                    sessionStorage.people = response.data.people;
                })
                .catch(e => {
                    this.errors.push(e)
                })
          }

          this.people= sessionStorage.people

this.people is bound to a vue component with a v-for.

<v-flex v-for="person in people" xs12 sm6 lg3>
11 Jan
11 months ago

shaqaruden started a new conversation Axios | Automatic Caching?

Does Axios cache automatically? I don't remember if Jeffrey ever mentioned this.

09 Jan
11 months ago

shaqaruden left a reply on Post Method Not Allowed?

@bobbybouwmann I didn’t changed anything.

08 Jan
11 months ago

shaqaruden left a reply on Error: "Your Requirements Could Not Be Resolved To An Installable Set Of Packages."

I had a similar issue with a linux fork of Laravel Valet (cpriego/valet-linux) for Linux and the solution for me was to simply install Symfony Process 3.4.3 explicitly with composer.

composer global require symfony/process:3.4.3

shaqaruden left a reply on Post Method Not Allowed?

I filled out my form data again in Postman and this fixed my issue

23 Dec
11 months ago

shaqaruden left a reply on Post Method Not Allowed?

I don’t have the code on me but I did check that and there is a route for a post request to API/workcenter that calls the [email protected] method

22 Dec
11 months ago

shaqaruden started a new conversation Post Method Not Allowed?

I have created a resource controller using artisan and made a resource route group as well,

Route::resource('workcenter', 'WorkcenterController');

Using Postman I make a post request to /api/workcenter which should call the store() method on my controller but its calling the index() method instead. I commented my resource route and made a single route for the post method to the same URI and I get a

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException

21 Dec
11 months ago

shaqaruden left a reply on API Route Model Binding | Exception Handling

@burlresearch I got this working. My code is a lot cleaner now. Thank!

shaqaruden left a reply on API Route Model Binding | Exception Handling

I will check the logs tomorrow but it seems to be an issue with brewing up the AssociateCo troller

20 Dec
11 months ago

shaqaruden left a reply on API Route Model Binding | Exception Handling

@martinbean Thank you for the clarification.

@burlresearch I tried your method but when I am getting a Internal Error Code 500

shaqaruden left a reply on API Route Model Binding | Exception Handling

@martinbean as I stated in one of my previous replies that I did have laravel returning json but it was not the response I wanted. I did not want the stack trace just a simple json response.

@burlresearch thanks! I will try this a little later today.

19 Dec
1 year ago

shaqaruden left a reply on API Route Model Binding | Exception Handling

@Cronix I tried placing this code in my App\Exceptions\Handler.php under the render function

if ($exception instanceof NotFoundHttpException) {
            return Response::json('Error');
        }

but this does not work, is there a way i could get send this back to the controller to be handled?

I don't need to use Route Model Binding but I was thinking that I must be able to do this.

shaqaruden left a reply on API Route Model Binding | Exception Handling

@burlresearch You see when an associate is not found it redirects to the 404 page. Now if I set the Accept and Content-Type Headers to application/json I then get a json response but it includes the stack trace and all i really want it

{
    "error": {
        "message": "Associate does not exist.",
        "status_code": 404
    }
}

shaqaruden left a reply on API Route Model Binding | Exception Handling

This is what I am doing

public function show($assoc)    
    {
        
        $associate = Associate::find($assoc);
        
        if ( ! $associate) {
            return $this->respondNotFound('Associate does not exist');
        }
        
        return $this->respond([
            'associate' => $this->associateTransformer->transform($associate->toArray())
        ]);
        
    }

This is what I want to do

public function show(Associate $associate)    
    { 
        return $this->respond([
            'associate' => $this->associateTransformer->transform($associate->toArray())
        ]);
        
    }

and if an associate is not found

return $this->respondNotFound('Associate does not exist');
18 Dec
1 year ago

shaqaruden started a new conversation API Route Model Binding | Exception Handling

How do I handle exceptions from Route Model Binding? I am building an API and I don't want an exception to be thrown when the record passed is not found I want to send a JSON response

15 Dec
1 year ago

shaqaruden left a reply on JSON Request Validation

I am not doing authentication at the moment and yes I have the application/json header

14 Dec
1 year ago

shaqaruden started a new conversation JSON Request Validation

I am using Postman to test my API.

When validating request data sent from Postman I get redirected to the home page if validation fails.

shaqaruden left a reply on JSON API | POST\PATCH Request

The function is being called but the json response is not being delivered

shaqaruden left a reply on Postman Patch Request

The route is in API.php

shaqaruden left a reply on Postman Patch Request

I know what to do for a website but I was just thinking if I specified the content type to be Json in postman a simple put or patch request would work.

13 Dec
1 year ago

shaqaruden started a new conversation Postman Patch Request

Using Postman my application does not respond to a PATCH request. I have to send a POST request with the _method = PATCH field.

Why is this?

shaqaruden started a new conversation JSON API | POST\PATCH Request

I am building a small JSON API and I am having issues with getting a JSON back from a PATCH request(POST Request with _method 'PATCH' field). The status code does not change to whatever i set it to and the there is no message or associate objects returned. This also applies to my POST

I am using a restful controller and following the practices shown in the Incremental API Course.

Here is the method that is called when an patch request is sent.

public function update($assoc, Request $request)
    {

        //Associate Stuff
        
        $this->respondUpdated('Associate successfully updated!', $associate);
    }

Here is the respondUpdated method

protected function respondUpdated($message, $associate) {
        return $this->setStatusCode(IlluminateResponse::HTTP_OK)->respond([
            'message' => $message,
            'associate' => $this->associateTransformer->transform($associate->toArray())
        ]);
    }