SANTI1111

SANTI1111

Member Since 1 Year Ago

Experience Points 160
Experience Level 1

4,840 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.

30 Jun
1 year ago

SANTI1111 left a reply on Getting An Error On The Command: Php Artisan Migrate

PLEASE, BE SURE YOU HAVE THE CORRECT DB_PORT ON THE .env FILE

26 Jun
1 year ago

SANTI1111 left a reply on I Can Not Run Php Artisan Migrate

try to put parameters to the columns in the table also if they are nullable

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

@cronix I only see an edit button and an email notification button

25 Jun
1 year ago

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

this issue is solved

I don't know how to put this to 'solved'

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

@36864 YES SIR!!

I was recently changing the code and testing and it worked on the post route!

However in the PUT route I couldn't remove the slash because I was passing another ID.

however it's all working great!!!

Really grateful to you!!!

<code>
Route::get('products/{id}/images', '[email protected]')->middleware('auth');
Route::post('products/{id}/create', '[email protected]')->middleware('auth');
Route::put('/images/{id}/update', '[email protected]')->middleware('auth');
</code>

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

controller

<code>

<?php

namespace App\Http\Controllers;

use App\Image;
use App\Product;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;

class ImageController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index($id)
    {
        // dd(Auth::user()->id);
        // dd($id);
        $products = Product::find($id);
        $u=$products->user_seller_id;
        $p=$products->id;

        $images = DB::table('images')->where('product_id', '=' ,$id)->where('active', '=', 1)->get();
        // $images = Image::whereNotNull('name')->get();
        // dd($images);
        if ($u === Auth::user()->id) {            
            return view('images.index')
                    -> with(compact('p') )
                    ->with(compact('images'));


        }else{
            return back();
        }
       
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store($id, Request $request)
    {

          $this->validate($request, [  
          'image'=>'required|image',
          ],
          [
          'image.required' => 'Tenes que Subir una Imagen para la PublicaciĆ³n',
          'image.image' => 'La Imagen Tiene que ser un archivo JPG, JPEG, PNG, ETC'
          ]
          );
        
        // dd(Product::find($id));
        $image=Image::create([
            'name'=>str_slug($request->input('image') ),
            'product_id'=>Product::find($id)->id,
            'user_id'=>Auth::user()->id
        ]);

        $nombreImagen= Auth::user()->id . '.' . uniqid() . '.' .request()->image->getClientOriginalName();
        
        request()->image->storeAs('public', $nombreImagen);

        $image->name = $nombreImagen;

        $image->save();

        return back();

    }

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

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
       // $image=DB::table('images')->where('id', '=', $id)->first();
        $image=Image::find($id);
       $image->active=0;
       $image->save();
       return back();
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //

    }
}

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

View

<code>

<form class='formulario' action='/images/{{$p}}/create/' method='POST' id='create' enctype='multipart/form-data'>
    {{ csrf_field() }}
    <label for='img' class='text-label'>Subi Fotos de a una: </label> <br>
    <input type='file' name='image' id='img' class='decorative-input-imagen-boton'> <br>

    @if ($errors->any())
        <div class="msj_error">
            <ul>
                @foreach ($errors->all() as $error)
                    <li class="msj_error">{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif
    <input type="submit" name="submit" class="enviar" value="SUBIR FOTO">
</form>




SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

@36864 I recently tried, but still same error on production environment its on a AWS elastic beanstalk with a RDS_DB

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

@36864 yes I did, but still the same error since @biishmar advice me to do that.

I really don't know

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

View

    {{ csrf_field() }}
    <label for='img' class='text-label'>Subi Fotos de a una: </label> <br>
    <input type='file' name='image' id='img' class='decorative-input-imagen-boton'> <br>

    @if ($errors->any())
        <div class="msj_error">
            <ul>
                @foreach ($errors->all() as $error)
                    <li class="msj_error">{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif
    <input type="submit" name="submit" class="enviar" value="SUBIR FOTO">
</form>

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

@cronix hope to that code could be clear, to fix this problem thanks

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

** {{ csrf_field() }} Subi Fotos de a una:

@if ($errors->any())
    <div class="msj_error">
        <ul>
            @foreach ($errors->all() as $error)
                <li class="msj_error">{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif
<input type="submit" name="submit" class="enviar" value="SUBIR FOTO">
**

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

view. (can't upload the post with form tag)

OPEN FORM class='formulario' action='/images/{{$p}}/create/' method='POST' id='create' enctype='multipart/form-data'> {{ csrf_field() }} Subi Fotos de a una:

@if ($errors->any())
    <div class="msj_error">
        <ul>
            @foreach ($errors->all() as $error)
                <li class="msj_error">{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif
<input type="submit" name="submit" class="enviar" value="SUBIR FOTO">

CLOSE FORM

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

{{ csrf_field() }} Subi Fotos de a una:

SANTI1111 left a reply on MethodNotAllowedHttpException Only Production

@biishmar, tried and still not working(same error)

this is the form view:

{{ csrf_field() }} Subi Fotos de a una:
@if ($errors->any())
    <div class="msj_error">
        <ul>
            @foreach ($errors->all() as $error)
                <li class="msj_error">{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif
<input type="submit" name="submit" class="enviar" value="SUBIR FOTO">

route: Route::post('/images/{id}/create', '[email protected]')->middleware('auth');

controller: public function store($id, Request $request) {

      $this->validate($request, [  
      'image'=>'required|image',
      ],
      [
      'image.required' => 'Tenes que Subir una Imagen para la PublicaciĆ³n',
      'image.image' => 'La Imagen Tiene que ser un archivo JPG, JPEG, PNG, ETC'
      ]
      );
    
    // dd(Product::find($id));
    $image=Image::create([
        'name'=>str_slug($request->input('image') ),
        'product_id'=>Product::find($id)->id,
        'user_id'=>Auth::user()->id
    ]);

    $nombreImagen= Auth::user()->id . '.' . uniqid() . '.' .request()->image->getClientOriginalName();
    
    request()->image->storeAs('public', $nombreImagen);

    $image->name = $nombreImagen;

    $image->save();

    return back();

}

24 Jun
1 year ago

SANTI1111 started a new conversation MethodNotAllowedHttpException Only Production

(1/1) MethodNotAllowedHttpException in RouteCollection.php (line 251) at RouteCollection->methodNotAllowed(array('POST')) in RouteCollection.php (line 238) at RouteCollection->getRouteForMethods(object(Request), array('POST')) in RouteCollection.php (line 176) at RouteCollection->match(object(Request)) in Router.php (line 548) at Router->findRoute(object(Request)) in Router.php (line 527) at Router->dispatchToRoute(object(Request)) in Router.php (line 513) at Router->dispatch(object(Request)) in Kernel.php (line 176) at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) in Pipeline.php (line 30) at Pipeline->Illuminate\Routing{closure}(object(Request)) in TransformsRequest.php (line 30) at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php (line 148) at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php (line 53) at Pipeline->Illuminate\Routing{closure}(object(Request)) in TransformsRequest.php (line 30) at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php (line 148) at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php (line 53) at Pipeline->Illuminate\Routing{closure}(object(Request)) in ValidatePostSize.php (line 27) at ValidatePostSize->handle(object(Request), object(Closure)) in Pipeline.php (line 148) at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php (line 53) at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php (line 46) at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php (line 148) at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php (line 53) at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php (line 102) at Pipeline->then(object(Closure)) in Kernel.php (line 151) at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php (line 116) at Kernel->handle(object(Request)) in index.php (line 53)

need some help here. I checked the view, route and controller and in my local environment the post is actually storing images...

what could it be?

thanks