plutarcomp

plutarcomp

Member Since 1 Year Ago

Experience Points 720
Experience Level 1

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

24 Dec
5 months ago
19 Dec
5 months ago

plutarcomp left a reply on Eloquent Where From Two Models

@REALRANDYALLEN - Perfect!!! in fact i use this code, but it returns empty.

I have this:

public function tourestacione()
    {
      return $this->hasMany('App\ToursEstacione')->select(array('id','name'));
    }

or

public function tourestacione()
    {
      return $this->hasMany('App\ToursEstacione')->select('id','name');
    }

and it return empty

but when i use

public function tourestacione()
    {
      return $this->hasMany('App\ToursEstacione');
    }

i receive all the info.

how can i get only certain columns?

thanks

plutarcomp started a new conversation Eloquent Where From Two Models

I need to get only the available tour from TOURS (this is a model) and the details in TOURSESTACIONE (my second model), im trying this:

$todas = ToursEstacione::with('tours')
                              ->whereBetween('latitude',[($lat - ($dist*0.014)),($lat + ($dist*0.014))])
                              ->whereBetween('longitude',[($long - ($dist*0.014)),($long + ($dist*0.014))])
                              ->get();

i modify my tours model with this:

  public function tours()
    {
      return $this->belongsTo('App\Tour','tour_id')->select('id','name','icon_tour')->where('status',1);
    }

I get all the records in ToursEstacione, but in the label tours i receive only in the ones are with status = 1 a value, the others return null.

I need to receive only the records that has status = 1

Thanks for your help

13 Dec
6 months ago

plutarcomp left a reply on Pass Variables From Controller To Model

@AURAWINDSURFING - thanks, i try it too, but i have this error:

"message": "Method Illuminate\Database\Query\Builder::conlocalizacion does not exist.", "exception": "BadMethodCallException",

plutarcomp started a new conversation Pass Variables From Controller To Model

I need to pass three varables i get in my controller via API and pass it to a model that need to search some criteria.

This is my controller

public function getTours($lat,$long,$dist)
    {
      $todas = Tour::select('id')->where('status',1)->with('conlocalizacion')->get();
      return $todas;
    }

i need to pass to model 'conlocalizacion' three variables to process a search in that.

This is my model

public function conlocalizacion()
    {
      return $this->hasMany('App\ToursEstacione')
             ->whereBetween('latitude',[($lat - ($dist*0.014)),($lat + ($dist*0.014))])
                         ->whereBetween('longitude',[($long - ($dist*0.014)),($long + ($dist*0.014))]);
    }

i try to use with(), but nothing happend.

Thanks

24 Oct
7 months ago

plutarcomp left a reply on Merge Two Records Having Same Id

Thanks a lot @lostdreamer_nl , your advice is very useful

plutarcomp started a new conversation Merge Two Records Having Same Id

i have a join query of two tables

PROMOS: 
id
name
icon_url
challenge
etc...

 HORARIOS:
days
hours
promo_id

Every promo can have two horarios, this means that some records only have one horario, but others, two horarios, thats why i use join

DB::table('promos')
                        ->join('horarios', function($join) use ($quehoraes){
                          $join->on('horarios.promo_id','=','promos.id');
                        })            ->select('promos.id','promos.name','promos.icon_url','promos.challenge','promos.img_reco','promos.latitude','promos.longitude','horarios.clicks','horarios.hours','horarios.days')
                        ->where('status',1)
                        ->get();

so as a result i have the records from the query, when a promo only have one horario i receive a record, but if the promo has two horarios i receive two records with the same id but with diferent info in days and hours.

[
    {
        "id": 1,
        "name": "Camellon",
        "icon_url": "loquesea.jpg",
        "challenge": "Debe hacer una primaide de al menos 3 personas y gritar fuerte QUIERO MI HELADO DE CHOLOCATE",
        "img_reco": "foto1.jpg",
        "clicks": 10,
        "hours": 12,
        "days": "2"
    },
    {
        "id": 2,
        "name": "Vito Alessio",
        "icon_url": "loquesea.jpg",
        "challenge": "¿Cual es el tamaño de un taco al pastor?",
        "img_reco": "foto1.jpg",
        "clicks": 21,
        "hours": 12,
        "days": "1"
    },
    {
        "id": 2,
        "name": "Vito Alessio",
        "icon_url": "loquesea.jpg",
        "challenge": "¿Cual es el tamaño de un taco al pastor?",
        "img_reco": "foto1.jpg",
        "clicks": 43,
        "hours": 13,
        "days": "0"
    },
    {
        "id": 3,
        "name": "Kiosco",
        "icon_url": "loquesea.jpg",
        "challenge": "Debes pedirlo asi, soy un payaso y deseo mis productos",
        "img_reco": "foto1.jpg",
        "clicks": 32,
        "hours": 15,
        "days": "1,3,6,2"
    },
    {
        "id": 5,
        "name": "Parisina",
        "icon_url": "loquesea.jpg",
        "challenge": "Telas parisina",
        "img_reco": "foto1.jpg",
        "clicks": 54,
        "hours": 19,
        "days": "2,3,4"
    },
    {
        "id": 7,
        "name": "cafesito rico",
        "icon_url": "loquesea.jpg",
        "challenge": "ponte a brincar",
        "img_reco": "foto1.jpg",
        "clicks": 21,
        "hours": 7,
        "days": "4,2,3"
    }
]

I need to get only one record from every promo, and in the case it has two horarios, the field clicks, hours, days merge the content of the two records in one.

My first aproach is to process the collection with map function and apply a function, but i cant see how to do the work.

Thanks.

18 Jun
1 year ago

plutarcomp left a reply on Android App Access Database Via Laravel

Thanks,

this will be the best practice, Android - Laravel API?

Something to manage the token for an unique login session?

plutarcomp started a new conversation Android App Access Database Via Laravel

Hi, I am working developing an Android app, but i need a lot of info from a database, in some other posts says that i need to use a REST client and use their webservices to get or write the info into/from the database, i want to know if someone have an experience with Laravel, and if is the best way to do.

I am a Laravel developer, and this is the fisrt time i need to integrate the app with this, especialy with the login info.

Thanks.

30 Apr
1 year ago

plutarcomp left a reply on Process Only One Time A File In Shared Folder

Thanks @Snapey , about the process to fill the S3 is with an Android and IOS apps, thats why i get so many files. How can i pick one file (the oldest) in Laravel?, i am trying but i cant get the way.

plutarcomp left a reply on Process Only One Time A File In Shared Folder

Thanks @bobbybouwmann thats right, i will search about .lock and how to manage in Laravel. About to manage simple file, i think this is the best way, but i cant find how to get only one file (and the oldest one) at a time from AWS S3 in Laravel.

26 Apr
1 year ago

plutarcomp started a new conversation Process Only One Time A File In Shared Folder

I have an Android and IOS app that uploads images (about 15,000 per minute) to a AWS S3 bucket, everything is all right, but i need to process those images from 2 - 50 different monitors, every monitor begin to scan the S3 bucket for the filenames, something like:

$recibidos = Storage::disk('s3recibidos');
$total_archivos = $recibidos->allfiles();

with this i have an array with the files are stored in the time the route is invoked, i understand that with one monitor there is no problem, because the process is one time only, but what about 2 or more monitors? the process retrieves no the exact list but i think many of the un processed files will be duplicated.

I need help in this two things:

1.- How to deal with the process. 2.- How can i use wildcards, because one of the final process changes the filename of the files in S3, so the filename list that i need to process has its exepecific format.

Thanks for any advice

24 Apr
1 year ago

plutarcomp started a new conversation Multiple Tasks Simultaneously

I need to process several image files from a directory, the process is to read the filename (id and type) that is stored in the directory in the moment is invoked the process (im using cron and schedule, it works great) the objetive of the process is to store the info into a database.

I have the process working, it works great but my problem is the number of files that is in the directory, because every second adds a lot more files to the directory, the time spent in the process is about 0.19 sec for file, but the amount of files is huge, about 15,000 per minute is added, so i think a multiple simultaneous process (about 10 - 40 times) of the same original process can do the job.

I need some advice or idea,

First to know how to launch multiple process at the same time of one original process.

Second how to get only the non selected filenames bcause the process takes the filenames with:

      $recibidos = Storage::disk('s3recibidos');

      if(count($recibidos) <= 0)
      {
        $lognofile = ['Archivos' => 'No hay archivos para procesar'];
        $orderLog->info('ImagesLog', $lognofile);
      }else{
        $files = $recibidos->files();
    
        if(Image::count() == 0)
        {
          $last_record = 1;
        } else{
            $last_record = Image::latest('id')->pluck('id')->first()+1;
        }
        $i=$last_record;
        $fotos_sin_info = 0;
        foreach($files as $file)
        {
          $datos = explode('_',$file);
          $tipos = str_replace('-','',$datos[2]);
          Image::create([
            'client_id' => $datos[0],
            'tipo' => $tipos,
          ]);
          $recibidos->move($file,'/procesar/'.$i.'.jpg');
          $i++;
        }

but i dont figured out how to retrieve only the non selected.

Thanks for your comments.