devingray_

Member Since 1 Year Ago

Experience Points
23,440
Total
Experience

1,560 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
45
Lessons
Completed
Best Reply Awards
29
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 5
23,440 XP
Mar
07
1 day ago
Activity icon

Replied to Bundle Laravel Package's Js/Css Alongside The Application

I don't quite understand?

You want to have one app.js (with vue router) and then use other js files that still work within that file that has the router?

EG:

js/app.js and css/app.css => Base application with router

--

js/team1.js and css/team1.css => Team 1

js/team2.js and css/team2.css =>Team 2

--

I think if these teams are creating router pages, this is way more difficult than just splitting the code in folders and compiling all into same files.

Mar
03
5 days ago
Activity icon

Replied to Period In A URL Gives 403

is the variable 1/2 Kopek ? What gets passed to the route?

EG <a href="/eBayX/???/ANY/Russia/1734"></a>

Activity icon

Awarded Best Reply on Credentials Do Not Match On Breeze

Because Breeze does it like this

$user->forceFill([
     'password' => Hash::make($request->password),
       'remember_token' => Str::random(60),
  ])->save();

See here https://github.com/laravel/breeze/blob/8710e3260a0d8dc7dc64378c4da64b5f36dc4c41/stubs/default/App/Http/Controllers/Auth/NewPasswordController.php#L43

Your User Model has

 public function setPasswordAttribute($value)
    {
        $this->attributes['password'] = bcrypt($value);
    }

So when the user model recieves it, it is already hashed by Breeze so you are bcrypt() - ing something already hashed

EG password = 'hello-darkness-my-old-friend' => Goes to breeze controller and becomes 1217874738383(randomhash) => Gets set by user model and becomes 762r27337376734(another-hash)

Activity icon

Replied to Render View Of Markdown Files

I like to use this

https://github.com/spatie/sheets

Makes it really easy to do this

Activity icon

Replied to Credentials Do Not Match On Breeze

Because Breeze does it like this

$user->forceFill([
     'password' => Hash::make($request->password),
       'remember_token' => Str::random(60),
  ])->save();

See here https://github.com/laravel/breeze/blob/8710e3260a0d8dc7dc64378c4da64b5f36dc4c41/stubs/default/App/Http/Controllers/Auth/NewPasswordController.php#L43

Your User Model has

 public function setPasswordAttribute($value)
    {
        $this->attributes['password'] = bcrypt($value);
    }

So when the user model recieves it, it is already hashed by Breeze so you are bcrypt() - ing something already hashed

EG password = 'hello-darkness-my-old-friend' => Goes to breeze controller and becomes 1217874738383(randomhash) => Gets set by user model and becomes 762r27337376734(another-hash)

Activity icon

Replied to Credentials Do Not Match On Breeze

Here

 public function setPasswordAttribute($value)
    {
        $this->attributes['password'] = bcrypt($value);
    }

This will override the way Breeze handles it

Activity icon

Replied to Laravel Broadcasting Broadcasting In Private Chanel Not Working

What auth middleware are you using?

Activity icon

Replied to How To Deploy Laravel With Front End React Integration?

There are many ways to do this. You should be more specific.

What hosting provider?

Is the react code in a different repo?

Mar
02
6 days ago
Activity icon

Replied to Credentials Do Not Match On Breeze

Have you checked that the password is being hashed correctly?

in Breeze it will update the password like this

$user->forceFill([
     'password' => Hash::make($request->password),
       'remember_token' => Str::random(60),
  ])->save();

Sometimes we override this in the User model where we set how password should be saved which will override the hash. Have you maybe done that?

Activity icon

Awarded Best Reply on Laravel Verify Email Auth Route With Locale

The Email that gets sent is done using the following:

$request->user()->sendEmailVerificationNotification();

So you could override this in your model

<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable implements MustVerifyEmail
{
    use HasFactory, Notifiable;

    public function sendEmailVerificationNotification()
    {
        ...Your Logic Here
    }
}

Will probably look something like this

public function sendEmailVerificationNotification()
    {
        $this->notify(new CustomEmail);
    }

And then the CustomEmail class will look like this

<?php
namespace App\Notifications;
use Illuminate\Auth\Notifications\VerifyEmail;

class CustomEmail extends VerifyEmail
{
    protected function verificationUrl($notifiable)
    {
        if (static::$createUrlCallback) {
            return call_user_func(static::$createUrlCallback, $notifiable);
        }

        return URL::temporarySignedRoute(
            .... ADD ROUTE WITH LOCALE HERE
            Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
            [
                'id' => $notifiable->getKey(),
                'hash' => sha1($notifiable->getEmailForVerification()),
            ]
        );
    }
}

This is just an option. I am sure there are other ways

Activity icon

Replied to Laravel Verify Email Auth Route With Locale

Yeah, but it can be any class really as you are extending another class. but I would put in same folder with notifications as VerifyEmail is a notification class

Mar
01
1 week ago
Activity icon

Awarded Best Reply on How To Push Nova App

This is not an issue with Nova but actually an issue with your git

Did you do it like this

git checkout -b my-branch
git add .
git commit -m "commit message"
git push origin my-branch
Feb
28
1 week ago
Activity icon

Replied to Laravel Verify Email Auth Route With Locale

The Email that gets sent is done using the following:

$request->user()->sendEmailVerificationNotification();

So you could override this in your model

<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable implements MustVerifyEmail
{
    use HasFactory, Notifiable;

    public function sendEmailVerificationNotification()
    {
        ...Your Logic Here
    }
}

Will probably look something like this

public function sendEmailVerificationNotification()
    {
        $this->notify(new CustomEmail);
    }

And then the CustomEmail class will look like this

<?php
namespace App\Notifications;
use Illuminate\Auth\Notifications\VerifyEmail;

class CustomEmail extends VerifyEmail
{
    protected function verificationUrl($notifiable)
    {
        if (static::$createUrlCallback) {
            return call_user_func(static::$createUrlCallback, $notifiable);
        }

        return URL::temporarySignedRoute(
            .... ADD ROUTE WITH LOCALE HERE
            Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
            [
                'id' => $notifiable->getKey(),
                'hash' => sha1($notifiable->getEmailForVerification()),
            ]
        );
    }
}

This is just an option. I am sure there are other ways

Activity icon

Replied to How To Push Nova App

This is not an issue with Nova but actually an issue with your git

Did you do it like this

git checkout -b my-branch
git add .
git commit -m "commit message"
git push origin my-branch
Feb
27
1 week ago
Activity icon

Awarded Best Reply on Secure Against Laravel 8.4.2 Debug Mode - Remote Code Execution

Running on an older version of Laravel is one of the reasons why you are getting attacked. (Although if you know how to prevent this, it would not be an issue)

The simplest solution would be to try to upgrade as best you can to the latest version of Laravel as there have been many security patches since 6.X

You can use a tool like shift to help you with this

https://laravelshift.com

You can read more about how this specific attack is used and try to work around it here

https://www.ambionics.io/blog/laravel-debug-rce

Feb
24
1 week ago
Activity icon

Replied to Having Trouble Understanding BPMN Frameworks.

No problem.

I think the solution to your problem is going to require a lot of custom code and integration from Laravel to the third parties which is normal. This state machines package is great for managing where the item is in your flow.

You can also take a look at Laravel Pipelines which may be of use within the application.

Something like this


public function index()
{
    $pipes = [
        RequestClientApproval::class,
        SyncWithAsana::class,
    ];

    $contract = Contract::create();

    $results = app(Pipeline::class)
        ->send($contract)
        ->through($pipes)
        ->then(
            ...
        );

    // return any type of response here
}

This will help you to pass data through a list of classes that will handle specific logic

Activity icon

Awarded Best Reply on Having Trouble Understanding BPMN Frameworks.

What is the question? Are you looking for a solution to run the process through each step before passing it on to the next one?

You can look at Laravel State Machines for this

https://github.com/asantibanez/laravel-eloquent-state-machines

Activity icon

Replied to Having Trouble Understanding BPMN Frameworks.

What is the question? Are you looking for a solution to run the process through each step before passing it on to the next one?

You can look at Laravel State Machines for this

https://github.com/asantibanez/laravel-eloquent-state-machines

Activity icon

Replied to Missing Required Parameters For [Route: About] [URI: En/content/{contentSlug}].

@michaloravec Yeah I had a poke around, and I am not sure what the issue is here, I actually doubt that these are real world problems, it seems all posts are just trolls for attention

Feb
23
1 week ago
Activity icon

Replied to Laravel Nova: Nested Templates Not Working In Custom Card Vue File?

Can you post the component as well as the code to register it

Activity icon

Replied to Property [size] Does Not Exist On This Collection Instance.

NP, @michaloravec has answered the question correctly below.

The attributes will return a collection of attributes because you have a HasMany Relationship

If a product hasMany attributes then you will need to decide which one of those instances you want to use.

If a product only has one attributes you should consider changing the relationship to reflect that

Activity icon

Replied to Property [size] Does Not Exist On This Collection Instance.

 <option value="{{$att->attributes->size}}">{{$att->attributes->size}}</option>
Activity icon

Replied to Missing Required Parameters For [Route: About] [URI: En/content/{contentSlug}].

Got it. Thats a shame, this community is awesome, so having that attitude really sucks. Will pay attention to this in future

Activity icon

Replied to Missing Required Parameters For [Route: About] [URI: En/content/{contentSlug}].

@michaloravec can you help to fill me in? Is this some sort of spam?

Activity icon

Replied to Laravel Nova! Stay Away

This is further from the truth than you think. Laravel Nova is a great package with simple and clear documentation.

My life is not a misery <3

Activity icon

Replied to AlpineJS : Only Open The Clicked Menu (looking For Better Approach)

This solution looks good as you can manage each card independently from eachother

I would add that x-data should be on a root element to prevent the DOM from getting confused

<div  x-data="{isOpen: false}">
 <button></button>
<div class="panel" x-show="isOpen">
	<div>option 1</div>
	<div>option 2</div>
</div>
<div>

<div x-data="{isOpen: false}">
 <button></button>
<div class="panel" x-show="isOpen">
	<div>option 1</div>
	<div>option 2</div>
</div>
<div>
Activity icon

Awarded Best Reply on Missing Required Parameters For [Route: About] [URI: En/content/{contentSlug}].

Do this

@php
$page = Page::first();
@endPHP

<a class="nav-link" href="{{ route('about', $page->slug }}">

This is just an example of how you want to use that route, you should do it however you normally would with MVC pattern

Activity icon

Replied to Missing Required Parameters For [Route: About] [URI: En/content/{contentSlug}].

Do this

@php
$page = Page::first();
@endPHP

<a class="nav-link" href="{{ route('about', $page->slug }}">

This is just an example of how you want to use that route, you should do it however you normally would with MVC pattern

Activity icon

Replied to Missing Required Parameters For [Route: About] [URI: En/content/{contentSlug}].

Obviously... You need to add the slug from your data.

You are accessing a route that requires a parameter {contentSlug} and you are not passing the slug to that route

Activity icon

Replied to Intergrating A Pacakge

@ifrit Did this work?

Activity icon

Replied to Missing Required Parameters For [Route: About] [URI: En/content/{contentSlug}].

You need to add the slug in the route

<a class="nav-link" href="{{ route('about', $slug) }}">
Feb
22
2 weeks ago
Activity icon

Replied to Passing Data From One View To Another

What do your routes for those views look like?

Like this?

Route::get('view-1', SomeController::class);
Route::get('view-2', SomeOtherController::class);

Where would you specify that the second route should accept data.

Activity icon

Replied to 404 Page Shown Rather Than Exception.

Add this to your App/Exceptions/Handler.php

public function render($request, Exception $e)
{
    if($e instanceof ModelNotFoundException) {
       // Do something
    }
    return parent::render($request, $e);
}

This tells Laravel how to handle ModelNotFoundException instead of throwing a 404

Activity icon

Awarded Best Reply on Can We Use Vue Js And Components Building Between The Laravel Project?

You are able to use both Vue and Blade in the same project if you wish.

It will look something like this

@extends('app')

@section('content')
   
    <x-blade-component />

   <vue-component />

@endsection

Unless you are wanting to use the SPA approach to vue, which will make the page a Single Page Application. The downsides of this is that SEO is difficult

Activity icon

Replied to Intergrating A Pacakge

What about

$conn = DB::connection()->getPdo();
$rollout = new Rollout(new PDOStorageAdapter($conn));
Activity icon

Awarded Best Reply on Nebula Package

Use Larsklopstra\Nebula\Fields\InputField;

Activity icon

Replied to Intergrating A Pacakge

I think the docs are pretty clear

Run this

composer require opensoft/rollout

Then use it where you want to

use Opensoft\Rollout\Rollout;
use Opensoft\Rollout\Storage\ArrayStorage;


class ExampleController
{

   public function helloWorld()
   {

      $rollout = new Rollout(new ArrayStorage());
      $rollout->isActive('chat', $user);
   }
}
Activity icon

Replied to How To Use Authentication In Laravel?

This question is very broad.

As a beginner I would suggest using Laravel Breeze or Jetstream

https://laravel.com/docs/8.x/starter-kits

OR

You can use Laravel Fortify which is an auth Package for Laravel

https://laravel.com/docs/8.x/fortify

Activity icon

Replied to Secure Against Laravel 8.4.2 Debug Mode - Remote Code Execution

Running on an older version of Laravel is one of the reasons why you are getting attacked. (Although if you know how to prevent this, it would not be an issue)

The simplest solution would be to try to upgrade as best you can to the latest version of Laravel as there have been many security patches since 6.X

You can use a tool like shift to help you with this

https://laravelshift.com

You can read more about how this specific attack is used and try to work around it here

https://www.ambionics.io/blog/laravel-debug-rce

Feb
21
2 weeks ago
Activity icon

Replied to Can We Use Vue Js And Components Building Between The Laravel Project?

You are able to use both Vue and Blade in the same project if you wish.

It will look something like this

@extends('app')

@section('content')
   
    <x-blade-component />

   <vue-component />

@endsection

Unless you are wanting to use the SPA approach to vue, which will make the page a Single Page Application. The downsides of this is that SEO is difficult

Activity icon

Replied to Loop Row In Bootstrap Every 3 Columns

What about

@foreach($files as $file)


  @if($loop->index % 3 == 0)
      .... This is is every 3rd
  @endif

@endforeach
Activity icon

Replied to Version Control With Fortify

@rpd What exactly are you trying to change? AFAIK there is not much in Fortify that you cannot do in the Actions

Activity icon

Replied to Version Control With Fortify

You should never make changes inside vendor folder. These file will be overwritten anytime you do composer update and there is a new version of that package.

The vendor folder is ignored in the .gitignore file because of this reason.

You should either publish the file (Not sure if possible to publish that file with fortify) or write your own

Feb
20
2 weeks ago
Activity icon

Replied to WithTrashed By Default For Model

You can use a global scope to achieve this

class WithTrashedScope implements Scope
{
    public function apply(Builder $builder, Model $model)
    {
        $builder->withTrashed();
    }
}

Then the model you can add the scope in the boot method EG: for User Model

class User extends Model
{
    protected static function boot()
    {
        parent::boot();

        static::addGlobalScope(new WithTrashedScope);
    }
}
Feb
19
2 weeks ago
Activity icon

Awarded Best Reply on Is It Possible To Use Computed Properties In Array Of Objects?

You cannot use it like that layers.name.computedName But you can use filters

layers.name | customFilter

https://vuejs.org/v2/guide/filters.html

Example

data: () => {
	layers: {name: 'Something', index: 0},
},
filters: {
  capitalize: function (value) {
    if (!value) return ''
    value = value.toString()
    return value.charAt(0).toUpperCase() + value.slice(1)
  }
}

usage

{{ layers.name | capitalize }}
Activity icon

Replied to Careful, Laravel Commands Are Not Careful

Lol, I also had a look at past questions and thread replies from the OP and they all seem to be very passive aggressive. Yikes. Pop Corn on me for the next one

Activity icon

Replied to Careful, Laravel Commands Are Not Careful

This thread has made my day