chechogrom

chechogrom

Member Since 8 Months Ago

Experience Points 430
Experience Level 1

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

18 Apr
1 month ago

chechogrom started a new conversation Which Loop While I Should Use And How

Hello everyone, I have a form in which I have a select with the plugin select 2 and I have the option of tags = true, in this select I send name-value-description (optional), and the format would be for example: john doe-15000 jane doe-12500-optional description.

for the user to send the correct format create a validation rule

form input

<div class="form-group col-md-6 {{ $errors->has('pagos') ? 'has-error' : '' }}">
    <label for="pagos">Pago / valor pago <i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right"              title="Ej: andres-50000 luis-78500"></i></label>
    <select class="form-control select2-pagos" multiple="multiple" name="pagos[]" data-placeholder="Dele un nombre al pago y su valor, separelos por '-'" style="width: 100%;">
      @if(is_array(old('pagos')))
        @foreach (old('pagos') as $pago)
            <option value="{{ $pago }}" selected="selected">{{ $pago }}</option>
        @endforeach
      @endif
    </select>
    @if ($errors->has('pagos'))
    <label class="control-label" for="pagos"><i class="fa fa-times-circle-o"></i>
      <strong>{{ $errors->first('pagos') }}</strong>
    </label>
    @endif
  </div>

request

    'pagos' => ['required', new ValidFormatPagos],

rule

public function passes($attribute, $values)
    {
      foreach ($values as $key => $value) {
        $pagoSeparados = explode('-',$value);
        // dd($values);
        if (count($pagoSeparados) == 2) {
          if (is_string($pagoSeparados[0]) && ctype_digit($pagoSeparados[1])) {
            return true;
          }
        }elseif (count($pagoSeparados) > 2) {
          if (is_string($pagoSeparados[0]) && ctype_digit($pagoSeparados[1]) && is_string($pagoSeparados[2]) != true) {
            return true;
          }
        }
      }
      return false;
    }

    /**
     * Get the validation error message.
     *
     * @return string
     */
    public function message()
    {
        return 'El formato para los pagos es incorrecto.';
    }

first I go through the values ​​that they send from the form with a foreach and I divide them by the character "-" (0 => "John doe", 1 => "15000") then I ask if the array is equal to 2 is that it comes name and value, the name will always be in pos 0 and the value in pos 1, then ask if the value in pos 0 is string and the value in pos 1 is an int, if these two conditions are true return true. up to here everything is fine, if in the select send ([john doe-15000] [Jane doe]) the validation happens since in the first condition it is true but the second one is not, how can I make it evaluate all the tags and not only the first, I'm sorry if I was not clear somewhere you can ask me, I'm using google translate, and thanks in advance to those who can help me

16 Apr
1 month ago

chechogrom left a reply on Collection Management

perfect, thank you very much

chechogrom left a reply on Collection Management

I just saw that it also separates them by "", is there a way to ignore the spaces? between the words ejm if the name is separated from the surname that is only one

chechogrom left a reply on Collection Management

I need them to access them afterwards, 0 = ids, 1 = names, 2 = values

thank you

chechogrom started a new conversation Collection Management

Hello everyone, I have this collection

Collection {#248 ▼
  #items: array:3 [▼
    0 => "1|luis-22500"
    1 => "2|sergio-12000"
    2 => "carlos-15000"
  ]
}

I want to know if for each item in the collection I can create a new one, separated by "|" and "-"

an example of how I would like to have it

Collection {#248 ▼
  #items: array:3 [▼
    0 => array:3 [▼
    0 => "1"
    1 => "luis"
    3 => "22500"
    ]
    1 => array:3 [▼
    0 => "2"
    1 => "sergio"
    3 => "12000"
    ]
    2 => array:2 [▼
    0 => "carlos"
    1 => "15000"
    ]
  ]
}

thanks in advance, I remain attentive

chechogrom left a reply on View [admin.users.index] Not Found. In Local It Works For Me, But In The Server Of Heroku Not

I'm wrong, I do not know how to know if the file exists, I'm using google translate

chechogrom left a reply on View [admin.users.index] Not Found. In Local It Works For Me, But In The Server Of Heroku Not

I'm working on windows with homestead which is an ubuntu machine and locally it works for me, but when I do git push heroku master and the deployment is done, all the routes except the resource type work for me

chechogrom left a reply on View [admin.users.index] Not Found. In Local It Works For Me, But In The Server Of Heroku Not

I made sure that the routes were fine from heroku in the console, but I know how to make sure that the file exists, how can I do it?

chechogrom started a new conversation View [admin.users.index] Not Found. In Local It Works For Me, But In The Server Of Heroku Not

Hello everyone, I just deployed an app of laravel 5.5 in heroku, I have these routes registered in web.php


<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

// Authentication Routes...
Route::get('login', 'Auth\[email protected]')->name('login');
Route::post('login', 'Auth\[email protected]');
Route::post('logout', 'Auth\[email protected]')->name('logout');

// Registration Routes...
// Route::get('register', 'Auth\[email protected]')->name('register');
// Route::post('register', 'Auth\[email protected]');

// Password Reset Routes...
Route::get('password/reset', 'Auth\[email protected]')->name('password.request');
Route::post('password/email', 'Auth\[email protected]')->name('password.email');
Route::get('password/reset/{token}', 'Auth\[email protected]')->name('password.reset');
Route::post('password/reset', 'Auth\[email protected]');

Route::get('/home', '[email protected]')->name('home');

Route::get('/administrador', function() {
  return view('admin.dashboard');
})->middleware('auth');

Route::group([
  'prefix' => 'admin',
  'middleware' => 'auth'],
function(){
  Route::resource('users', 'UserController');
  Route::resource('cuadres', 'CuadreController');
  Route::resource('pagos', 'PagoController');
  Route::resource('datafonos', 'DatafonoController');
});

for admin routes I have an admin prefix like in the views folder I have a folder named "admin" admin> users> index.blade.php

locally all this works for me, example app.test/admin/users works

but when I do the same thing on the server it gives me this error ##View [admin.users.index] not found.

this is my controller for users

<?php

namespace App\Http\Controllers;

use App\User;
use Illuminate\Http\Request;

class UserController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
      $users = User::all();
      return view('admin.users.index', compact('users'));
    }

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

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
      User::create($request->all());

      return redirect()->route('users.index')->with('info','Se ha creado el usuario con éxito');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
    public function show(User $user)
    {
      return view('admin.users.show', compact('user'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
    public function edit(User $user)
    {
      return view('admin.users.edit', compact('user'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, User $user)
    {
      $user->update($request->all());
      return redirect()->route('users.index')->with('info', 'Se ha editado el usuario con éxito');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
    public function destroy(User $user)
    {
      if($user->id === auth()->user()->id){
        return back()->with('error', 'No te puedes eliminar a ti mismo');
      }

      $user->delete();
      return back()->with('info', 'Se ha eliminado el usuario con éxito');
    }
}

thanks in advance, I remain attentive

08 Oct
7 months ago

chechogrom started a new conversation Hello Everyone, How Can I Create A Validation Rule That Tells Me If A User Exists In The Database And If The User Exists To Ask If He Has An X Role

Hello everyone, how can I create a validation rule that tells me if a user exists in the database and if the user exists to ask if he has an x role, I am using the spatie / laravel-permission package for this, as well as returning the personalized messages for this, thanks in advance

the only thing I have is this:

if ($this->filled('quality_user_id')) { # ID control de calidad $this->quality_user_id = 3; $user = \App\User::findOrFail($this->quality_user_id); $isControlDeCalidad = $user->hasRole('Control De Calidad'); dd($this->quality_user_id, $user, $isControlDeCalidad);

      $rules['quality_user_id'] = [
        'quality_user_id' => 'required', 'string', 'max:100', Rule::exists('users')->where(function ($query) {
          $query->where('id', 'quality_user_id');
        }),
      ];
    }

$isControlDeCalidad returns if you have the role or not, but I want to ask first if the user exists in the bd and then the logic to know if it has the role and return the messages in case it does not exist or does not have the role

this piece of code I have not tried:

Rule::exists('users')->where(function ($query) {
          $query->where('id', 'quality_user_id');
        }),
03 Oct
7 months ago

chechogrom started a new conversation Hello Everyone, How Do I Show The First 6 Numbers And The Last 4 Numbers Of A String Or Number, Replacing The Ones In The Middle With "*"?

Hello everyone, how do I show the first 6 numbers and the last 4 numbers of a string or number, replacing the ones in the middle with "*"?

It is to show credit card numbers, previously I use decrypt since they are encrypted from db

thanks in advance

14 Sep
8 months ago

chechogrom started a new conversation How To Use Delay() In A Event In The Controller ?

hi guys, I currently have this:

public function store(CampaingRequest $request) {

         $campaing = new Campaing;
     $campaing->users = implode(',',array_values($request->users));
     $campaing->behaviors = $request->behaviors;
         $campaing->date = $request->date;
     $campaing->repeat_in = $request->repeat_in;
     $campaing->save();

        $delay = Carbon::now()->addMinutes(10);
        $delay = $delay->toTimeString();
        // dd($delay);


        CampaingCreated::dispatch($campaing)

->delay($delay);

I'm getting this:

"Call to a member function delay() on array"

however the event and the listener are executed

Thanks in advance

13 Sep
8 months ago

chechogrom left a reply on How Do I Add Events On Route::resource?

Hi, I would like to know how I can delay the event when it is executed, I have this:

public function store (CampaingRequest $ request) {

     $ campaing = new Campaing;      $ campaing-> users = implode (',', array_values ($ request-> users));      $ campaing-> behaviors = $ request-> behaviors;      $ campaing-> date = $ request-> date;      $ campaing-> repeat_in = $ request-> repeat_in;      $ campaing-> save ();

     $ delay = Carbon :: now () -> addMinutes (10);      $ delay = $ delay-> toTimeString ();      // dd ($ delay);

     CampaingCreated :: dispatch ($ campaing)              -> delay ($ delay);

Call to a member function delay () on array

however the event and the listener are executed

Thanks in advance

chechogrom started a new conversation How To Delay Event

I currently have this:

public function store(CampaingRequest $request) {

  // dd(implode(',',array_values($request->users)));

    $campaing = new Campaing;
    $campaing->users = implode(',',array_values($request->users));
    $campaing->behaviors = $request->behaviors;
    $campaing->date = $request->date;
    $campaing->repeat_in = $request->repeat_in;
    $campaing->save();

    $delay = Carbon::now()->addMinutes(10);
    $delay = $delay->toTimeString();
    // dd($delay);


    CampaingCreated::dispatch($campaing)
            ->delay($delay);

I'm getting this:

Call to a member function delay() on array

however the event and the listener are executed

Thanks in advance