Thibaultvanc

Thibaultvanc

Developper at France

Member Since 4 Years Ago

Grasse

Experience Points
109,120
Total
Experience

880 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
1023
Lessons
Completed
Best Reply Awards
6
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.

Level 22
109,120 XP
Aug
12
1 month ago
Activity icon

Started a new Conversation Vue : How To Set Data Properties "on The Fly"

Hello, in my Vue component : I need to dynamically set data properties to the root.

<template>
	<div>{{ onTheFly }}</div>
</template>

<script>
export  default {
	data(){
		return  {
			// start empty (very important)
		}
	},
	created(){
		// initialize a reactive param  (this does not work...)
		this.$set(this,  'onTheFly', 'my value')
	}
}	
</script>
Aug
06
1 month ago
Activity icon

Awarded Best Reply on Check If File Exists In Public Folder

@msslgomez \File::exists(public_path('ReportesTodos-5.zip')); will return true if the file exists

Aug
05
1 month ago
Activity icon

Replied to Check If File Exists In Public Folder

hello @msslgomez change the .env file -> APP_DEBUG=true to see the exact error. Knowing the exact error leads to the solution

Activity icon

Replied to Check If File Exists In Public Folder

@msslgomez Is your problem is solved ?

Activity icon

Replied to Check If File Exists In Public Folder

nothing, it just work, it's included in Laravel

Activity icon

Replied to Check If File Exists In Public Folder

@msslgomez \File::exists(public_path('ReportesTodos-5.zip')); will return true if the file exists

Activity icon

Replied to Relationships Between Eloquent Models In Different Folders

You can play with the namespaces

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

@redroseamit

  • did you place the dd('here'); to be sure you hit the good controller method ?
  • di you see 'here' at the screen while updating ?
Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

as @michaloravec say, you need to specify @method('PUT') in your form

Also I suggest you to place a temprary dd('here'); in your controller method to be sure you hit the method

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

Are you sure you pass the validation ?

Activity icon

Replied to Learning Laravel

To be a professional on laravel, you need :

  • passion
  • patience
  • code every single day
  • watch all the tutorials you can
  • read code written by professional
  • find your first client
  • believe in youself

You need to have your own side project to learn

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

Do you have any errors ? How do you see it dos not work ?

Aug
02
1 month ago
Activity icon

Replied to Model Class Instance Question

class Test {
  
  protected $datas = [];


  public function push($row)
  {
	return $this->data[] = $row;
  }
  
  public function first()
  {
	return $this->data[0];
  }

}

$test = new Test();
$test->push(['id' => 1, 'name' => 'John']);
$test->first();
Activity icon

Replied to Model Class Instance Question

The plus sign indicates that the property has been set onthe fly. In other word you do not have declared the $id and $name properties

Activity icon

Replied to Model Class Instance Question

Your first method is hard coded here

Consider a Test class like this :

Class Test {

    public $id;
    public $name;

    public function _construct($id, $name)
    {
         $this->id = $id;
         $this->name = $name;
    }

}
Activity icon

Awarded Best Reply on Display String Data In Blade Blade Loop

yes it's an array, and not an object

this should work :

@foreach( json_decode($post->image, true) as $photo)
 <li class="glide__slide">
         <img src="/storage/{{$photo['basename']}}" class="photo__file"/>
 </li>
@endforeach
Activity icon

Replied to Display String Data In Blade Blade Loop

Consider creating a new question on this forum , you will probably have a better answer, but I can tell you my point of view :

Your store method is not too bad. but you can simplify it with the storage facade

Activity icon

Replied to Display String Data In Blade Blade Loop

yes it's an array, and not an object

this should work :

@foreach( json_decode($post->image, true) as $photo)
 <li class="glide__slide">
         <img src="/storage/{{$photo['basename']}}" class="photo__file"/>
 </li>
@endforeach
Activity icon

Replied to Display String Data In Blade Blade Loop

try $photo['basename']

like this

 <li class="glide__slide">
         <img src="/storage/{{$photo['basename']}}" class="photo__file"/>
 </li>

Activity icon

Replied to Display String Data In Blade Blade Loop

yes here, @loyd , please do a {{ dd($photo) }} But I think it's still an array

I think here you have to specify the key of the array you want to display and it will work

Activity icon

Replied to Display String Data In Blade Blade Loop

@haz_ you can see the value of $post->image in the first message.

It's a string like i said, @loyd need to json_encode

Activity icon

Replied to Display String Data In Blade Blade Loop

@loyd like before. Your $post->image is a string.

You need to json_decode($post->image, true) in the foreach

Note : the true option is to get an associative array

Hope it helps

Activity icon

Replied to Query Inside Foreach

Does it helped ?

Activity icon

Replied to Display String Data In Blade Blade Loop

Your $post->image is no a valid php array

Activity icon

Replied to Query Inside Foreach

Can try $products[] = .... To add new items in an array

Activity icon

Replied to Gender Dropdown Is Not Loading Data On Edit Blade

option value="{{$k}}" @if($employee->gender == $k) selected @endif>{{$gender}}</option>

should be

<option value="{{$k}}" @if($employee->gender == $k) selected @endif>{{$gender}}</option>
Activity icon

Replied to Gender Dropdown Is Not Loading Data On Edit Blade

okay @noblemfd . I think you also forget the < before the option tag ;)

Activity icon

Replied to Gender Dropdown Is Not Loading Data On Edit Blade

@noblemfd I can see a problem here:

 <select class="form-control select2bs4" data-placeholder="Choose Gender" tabindex="1" name="gender_code" style="width: 100%;">
                <option value="">Select Gender</option>
                 <option selected disabled>Select Gender</option>
                     @foreach($genders as $k => $gender)
                       option value="{{$k}}" @if($employee->gender == $k) selected @endif>{{$gender}}</option>
                     @endforeach
              </select>

Your 2 first options (before the foreach) are Select Gender and the second is already set as "selected" & "disabled"

Activity icon

Awarded Best Reply on Display String Data In Blade

@loyd you can try this

@foreach( json_decode($post->image, true) as $photo)
...
@endforeach
Activity icon

Awarded Best Reply on Some Thing Like Soft Delete In Model For Returning Only Active Models

I think you are looking for global scope : https://laravel.com/docs/7.x/eloquent#global-scopes

You can register it as follow

class Product extends Model
{
    
    protected static function booted()
    {
        static::addGlobalScope('active', function (Builder $builder) {
            $builder->where('active', 1);
        });
    }
}

and then Product::all() will return only actives products

Hope it helps

Activity icon

Replied to Display String Data In Blade

@loyd you can try this

@foreach( json_decode($post->image, true) as $photo)
...
@endforeach
Activity icon

Replied to Display String Data In Blade

It seems like an array, but i suppose this is actually a string . Try json_decode

Activity icon

Replied to Gender Dropdown Is Not Loading Data On Edit Blade

Please try {{ dd($genders) }} in your blade to see what is the value of this variable

Activity icon

Awarded Best Reply on HasMany On Different Table ?

Maybe you are looking for a ManyToMany relationship where you can specify the pivot table

Activity icon

Replied to HasMany On Different Table ?

@s4muel If you think about it, your current implementation allows a user to be invited by different users. Make a belongsToMany relation, when sending the invitation, you can check what you need

Activity icon

Replied to HasMany On Different Table ?

@s4muel maybe Consider making validation rules . I think it's the easiest way

Activity icon

Replied to HasMany On Different Table ?

Maybe you are looking for a ManyToMany relationship where you can specify the pivot table

Activity icon

Replied to Dynamic Tab Change On Form Submit In Vue.js

in your 'data' section of vue script : just create a state referencing the active tab. Then , after submitting your form, change the state accordingly

Activity icon

Replied to Some Thing Like Soft Delete In Model For Returning Only Active Models

@bugsysha Please consider marking the Best Reply above if your issue has been solved. Thanks.

Activity icon

Replied to Some Thing Like Soft Delete In Model For Returning Only Active Models

I think you are looking for global scope : https://laravel.com/docs/7.x/eloquent#global-scopes

You can register it as follow

class Product extends Model
{
    
    protected static function booted()
    {
        static::addGlobalScope('active', function (Builder $builder) {
            $builder->where('active', 1);
        });
    }
}

and then Product::all() will return only actives products

Hope it helps

Jul
06
2 months ago
Activity icon

Replied to Service Providers, Interfaces, And Models

Maybe ou should have a look at this package : https://github.com/calebporzio/parental

Jun
25
2 months ago
Activity icon

Awarded Best Reply on PHPunit - Testing A BelongsToMany Relationship In A Unit Test

assuming you have a tags method on the Post::class

$post = factory(Post::class)->create();
$tag = factory(Tag::class)->create();


$this->assertCount(0,$post->fresh()->tags);

$post->tags()->attach($tag);

$this->assertTrue($post->tags()->first()->is($tag));
$this->assertCount(1,$post->fresh()->tags);
Activity icon

Replied to PHPunit - Testing A BelongsToMany Relationship In A Unit Test

try $tag->posts()->attach($post);

Jun
24
3 months ago
Activity icon

Replied to I Got Symfony/translation Errors Installing Laravel 5 On Remote Server

i am pretty sure you do not use the right php version

try php --v and compare the required php version in your composer.json file

Activity icon

Replied to Problem With User Store And Update

replace required by nullable in

'password' => ['required', 'string', 'min:8', 'confirmed']

Activity icon

Replied to Problem With User Store And Update

try to add this in your blade

@if ($errors->any())
    <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

to see wich field does not pass the validation. If the validation does not pass, Laravel return to the previous page, so you feel like making a GET If your blade does not show the errors

Activity icon

Replied to Problem With User Store And Update

How do you know that it generate a GET ? maybe you are just redirected by the validator ?

try to add

@if ($errors->any())
    <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif