danultimate

danultimate

Member Since 1 Week Ago

Experience Points
200
Total
Experience

4,800 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
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • 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.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    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 1
200 XP
Dec
03
1 week ago
Activity icon

Replied to PUT Http://127.0.0.1:8000/api/suppliers/ 405 (Method Not Allowed)

I get Undefined index: proveedor when I try with the ID

Activity icon

Started a new Conversation PUT Http://127.0.0.1:8000/api/suppliers/ 405 (Method Not Allowed)

Im working on a code that should add or update new "suppliers"

after filling the form Im getting the error 405

Here is my update function of the controller.

public function update(Request $request, Suppliers $suppliers) { if ($suppliers === null) { return response()->json(['error' => 'Supplier not found'], 404); }

$validator = Validator::make(
    $request->all(),
    [

    ]
);

if ($validator->fails()) {
    return response()->json(['errors' => $validator->errors()], 403);
} else {
    $params = $request->all();
    $suppliers->proveedor = $params['proveedor'];
    $suppliers->contacto = $params['contacto'];
    $suppliers->telefono = $params['telefono'];
    $suppliers->email = $params['email'];
    $suppliers->pais = $params['pais'];
    $suppliers->direccion = $params['direccion'];
    $suppliers->calidad = $params['calidad'];
    $suppliers->pedidos = $params['pedidos'];
    $category->save();
}

return new SuppliersResource($suppliers);

}

/**
 * Remove the specified resource from storage.
 *
 * @param  \App\Laravue\Models\Suppliers  $suppliers
 * @return \Illuminate\Http\Response
 */
public function destroy(Suppliers $suppliers)
{
    //
}

}

Activity icon

Replied to Getting Undefined Index With A Post.

Noticed that the put comes from the api/resources.js file.

update(id, resource) { return request({ url: '/' + this.uri + '/' + id, method: 'post', data: resource, }); }

If I change the method to post, I don't get the error but don't update or create the new supplier.

Activity icon

Replied to Getting Undefined Index With A Post.

Someone told me that specify the method will be the solution but still getting the error.

<el-form ref="supplierForm" :model="currentSupplier" label-position="left" label-width="150px">

Dec
02
1 week ago
Activity icon

Replied to Getting Undefined Index With A Post.

Cant see anything.. Look online but no luck.

Activity icon

Replied to Getting Undefined Index With A Post.

Thanks again but my form don't have a method:

<el-dialog :title="formTitle" :visible.sync="supplierFormVisible">
  <div class="form-container">
    <el-form ref="supplierForm" :model="currentSupplier" label-position="left" label-width="150px" style="max-width: 500px;">
      <el-form-item label="Proveedor" prop="proveedor">
        <el-input v-model="currentSupplier.proveedor" />
      </el-form-item>
      <el-form-item label="Marca" prop="marca">
        <el-input v-model="currentSupplier.marca" />
      </el-form-item>
      <el-form-item label="Contacto" prop="contacto">
        <el-input v-model="currentSupplier.contacto" />
      </el-form-item>
      <el-form-item label="Telefono" prop="telefono">
        <el-input v-model="currentSupplier.telefono" />
      </el-form-item>
      <el-form-item label="Email" prop="email">
        <el-input v-model="currentSupplier.email" />
      </el-form-item>
      <el-form-item label="Pais" prop="pais">
        <el-input v-model="currentSupplier.pais" />
      </el-form-item>
      <el-form-item label="Direccion" prop="direccion">
        <el-input v-model="currentSupplier.direccion" />
      </el-form-item>
      <el-form-item label="Calidad" prop="calidad">
        <el-input v-model="currentSupplier.calidad" />
      </el-form-item>
      <el-form-item label="Pedidos" prop="pedidos">
        <el-input v-model="currentSupplier.pedidos" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="supplierFormVisible = false">
        Cancel
      </el-button>
      <el-button type="primary" @click="handleSubmit()">
        Confirm
      </el-button>
    </div>
  </div>
</el-dialog>
Activity icon

Replied to Getting Undefined Index With A Post.

Thank you so much for your help. looks like Im able to POST using postman but when I submit the form Im getting a 405 error.

The console shows this message

PUT http://127.0.0.1:8000/api/suppliers/ 405 (Method Not Allowed)

Activity icon

Replied to Getting Undefined Index With A Post.

More than one. could be unlimited

Activity icon

Replied to Getting Undefined Index With A Post.

Yes. {"data":[{"id":1,"proveedor":"OGmv6PfuBO","marca":"N8IojsEYMc","contacto":"RuagUqRhP0","telefono":1463235513,"email":"xIPTD221m6@gmail.com","pais":"vda9eFPoOY","direccion":"SQFZdYJ0sP","calidad":"RoMKm9HB72","pedidos":"foL8W9iLup"},{"id":2,"proveedor":"dWHZKInbOW","marca":"GooUCnerT3","contacto":"pAJkPcMr8G","telefono":1572260665,"email":"[email protected]","pais":"j8Vvy4Hoe2","direccion":"501tS7jd0p","calidad":"FGz2U0hXng","pedidos":"hWLgDSzVsC"}]}

Activity icon

Replied to Getting Undefined Index With A Post.

Thanks for your reply.

with the dump($request->all()); Now Im able make a post but the data isnt saved or displayed.

Activity icon

Started a new Conversation Getting Undefined Index With A Post.

I'm trying to fetch some data in a table, GET requests work ok but when I try to add a new column from the form.

Testing with postman gives me Undefined index: proveedor

This is my controller code:

public function store(Request $request)
{
    $validator = Validator::make(
        $request->all(),
        [

        ]
    );

    if ($validator->fails()) {
        return response()->json(['errors' => $validator->errors()], 403);
    } else {
        $params = $request->all();
        $suppliers = Suppliers::create([
            'proveedor' => $params['proveedor'],
            'code' => strtolower($params['proveedor']) . time(), // Just to make sure this value is unique
            'contacto' => $params['contacto'],
            'telefono' => $params['telefono'],
            'email' => $params['email'],
            'pais' => $params['pais'],
            'direccion' => $params['direccion'],
            'calidad' => $params['calidad'],
            'pedidos' => $params['pedidos'],
        ]);
        
        return new SuppliersResource($supplier);
    }
}