STEREOH

STEREOH

Software Engineer at Intitek.fr/APRR.fr

Member Since 5 Years Ago

Dijon

Experience Points
62,810
Total
Experience

2,190 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
382
Lessons
Completed
Best Reply Awards
45
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 13
62,810 XP
Apr
08
1 month ago
Activity icon

Replied to View Data According To Class And Class Group

$paper = Paper::where([
	['paper_type', 'PaperSolution'], 
	['class', Auth::user()->class]
])->get();

https://laravel.com/docs/7.x/queries#where-clauses

Activity icon

Replied to Php Artisan Serve

not having to use a web server

Apr
07
1 month ago
Activity icon

Replied to Laravel Route Question

To be able to do that :

route('profile', Auth::user());

You must give a name to your route :

Route::get('/profiles/{user}', '[email protected]')->name('profile');
Apr
06
1 month ago
Activity icon

Awarded Best Reply on NULL Value On Attach()

You have this in your User model

    public function schools()
    {
        return $this->belongsToMany(School::class,'school_student','school_id', 'student_user_id');
    }

and this in your Student model

    public function schools()
    {
        return $this->belongsToMany(School::class);
    }

not tested but imo you should specify the keys for the relation as you do in your user model.

EDIT : Or maybe

public function store(\App\Http\Requests\StudentAddSchoolStoreRequest $request)
    {
        $student = new Student();
	// Replace id with user_id
        $student->user_id = auth()->user()->id;
        $school = new School();
  
        $school->id = $request->id;
        $student->schools()->attach($request->id);

        return redirect('school')->with('message', 'Successful update!');
    }
Activity icon

Replied to NULL Value On Attach()

You have this in your User model

    public function schools()
    {
        return $this->belongsToMany(School::class,'school_student','school_id', 'student_user_id');
    }

and this in your Student model

    public function schools()
    {
        return $this->belongsToMany(School::class);
    }

not tested but imo you should specify the keys for the relation as you do in your user model.

EDIT : Or maybe

public function store(\App\Http\Requests\StudentAddSchoolStoreRequest $request)
    {
        $student = new Student();
	// Replace id with user_id
        $student->user_id = auth()->user()->id;
        $school = new School();
  
        $school->id = $request->id;
        $student->schools()->attach($request->id);

        return redirect('school')->with('message', 'Successful update!');
    }
Apr
03
1 month ago
Activity icon

Replied to Detect Every Change On Model

Eloquent offers plenty of events to a model's lifecycle.

https://laravel.com/docs/5.8/eloquent#events

Apr
02
1 month ago
Activity icon

Replied to Tips For Getting A Grasp On Laravel MVC?

Practice is, in my opinion and in your situation, the best way to go.

Try making a simple app ( ie: blog ) without following any course at all.

You are going to hit bumps, when it happens, take a brief moment to think, tinker , and if you can't find a solution, try googling your problem ( learning to search on google is an important skill ) or to find a solution in this forum.

Finally more specifically to the birdboard app. Since it's a TDD project you can try "Build a forum with TDD" wich is a bit older but very in-depth course (102 lessons) to keep learning on top of that.

Mar
31
2 months ago
Activity icon

Awarded Best Reply on VS Code Package For Overriding Methods?

Judging by this extension's doc,

https://marketplace.visualstudio.com/items?itemName=k--kato.intellij-idea-keybindings

this is not suported in vscode.

Mar
18
2 months ago
Activity icon

Awarded Best Reply on Multiple Bootstrap Radios Do Not Work With Laravel

That's not how Radios work.

<form action="{{ action('[email protected]_data') }}" method="POST">
  @csrf
    <div class="btn-group btn-group-toggle" data-toggle="buttons">
      <label class="btn btn-primary form-check-label">
        <input class="form-check-input" type="radio" name="type_of_cleaning" value="window" checked>
        Window Cleaning
      </label>
      <label class="btn btn-primary form-check-label">
        <input class="form-check-input" type="radio" name="type_of_cleaning" value="room" > Room Cleaning
      </label>
 
    </div>
    <h1>How many times cleaning</h1>

    <div class="btn-group btn-group-toggle" data-toggle="buttons">
      <label class="btn btn-primary form-check-label">
        <input class="form-check-input" type="radio" name="cleaning_times" value="weekly"  checked>
        Weekly
      </label>
      <label class="btn btn-primary form-check-label">
        <input class="form-check-input" type="radio" name="cleaning_times" value="monthly" > Monthly
      </label>
 
    </div>
    <br>
    <br>
    <br>
    <input class="btn btn-danger" type="submit">
</form>
    public function index(){


        return view('pages/index');
    }
    public function get_data(){
        $db = new PagesModel;
        $db->type_of_cleaning = request('type_of_cleaning');
        $db->cleaning_times = request('cleaning_times');
        $db->save();
       
        

        return redirect('/')->with('success', 'thank you');
    }
}

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio

Activity icon

Replied to Multiple Bootstrap Radios Do Not Work With Laravel

That's not how Radios work.

<form action="{{ action('[email protected]_data') }}" method="POST">
  @csrf
    <div class="btn-group btn-group-toggle" data-toggle="buttons">
      <label class="btn btn-primary form-check-label">
        <input class="form-check-input" type="radio" name="type_of_cleaning" value="window" checked>
        Window Cleaning
      </label>
      <label class="btn btn-primary form-check-label">
        <input class="form-check-input" type="radio" name="type_of_cleaning" value="room" > Room Cleaning
      </label>
 
    </div>
    <h1>How many times cleaning</h1>

    <div class="btn-group btn-group-toggle" data-toggle="buttons">
      <label class="btn btn-primary form-check-label">
        <input class="form-check-input" type="radio" name="cleaning_times" value="weekly"  checked>
        Weekly
      </label>
      <label class="btn btn-primary form-check-label">
        <input class="form-check-input" type="radio" name="cleaning_times" value="monthly" > Monthly
      </label>
 
    </div>
    <br>
    <br>
    <br>
    <input class="btn btn-danger" type="submit">
</form>
    public function index(){


        return view('pages/index');
    }
    public function get_data(){
        $db = new PagesModel;
        $db->type_of_cleaning = request('type_of_cleaning');
        $db->cleaning_times = request('cleaning_times');
        $db->save();
       
        

        return redirect('/')->with('success', 'thank you');
    }
}

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio

Mar
17
2 months ago
Activity icon

Replied to How To Make Option Without Value For Query, To Show Me All Tickets?

you can always add an empty option like that.

<option value="">All</option>

and this should work with your controller code

Activity icon

Awarded Best Reply on LoginController Login Method Redirect

you forgot to return the result of testRedirect() in your login method

Activity icon

Replied to LoginController Login Method Redirect

you forgot to return the result of testRedirect() in your login method

Activity icon

Replied to Design Registration System

What are those nullable fields you're talking about ? ( just for example )

Activity icon

Awarded Best Reply on How To Make Unique Field To Normal Field ?

Run this command.

php artisan make:migration drop_unique_key_on_nid_in_YOUR_TABLE --table=YOUR_TABLE

and in your newly created drop_unique_key_on_nid_in_YOUR_TABLE.php file in database/migrations

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class Test extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('YOUT_TABLE', function (Blueprint $table) {
            $table->dropUnique('YOUR_TABLE_nid_unique');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('YOUR_TABLE', function (Blueprint $table) {
            $table->unique('nid');
        });
    }
}

Just replace YOUR_TABLE with the name of your table.

Dropping a unique key will not alter your data. I wrote the down function but it will not work if your data is not unique so be careful.

Activity icon

Replied to How To Make Unique Field To Normal Field ?

Run this command.

php artisan make:migration drop_unique_key_on_nid_in_YOUR_TABLE --table=YOUR_TABLE

and in your newly created drop_unique_key_on_nid_in_YOUR_TABLE.php file in database/migrations

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class Test extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('YOUT_TABLE', function (Blueprint $table) {
            $table->dropUnique('YOUR_TABLE_nid_unique');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('YOUR_TABLE', function (Blueprint $table) {
            $table->unique('nid');
        });
    }
}

Just replace YOUR_TABLE with the name of your table.

Dropping a unique key will not alter your data. I wrote the down function but it will not work if your data is not unique so be careful.

Mar
13
2 months ago
Activity icon

Replied to Query Relationship Existance With Scope

exists() generates a request with a SELECT EXISTS( your query) , this should not load all of your results AFAIK.

If you are not convinced, you can always do :

$this->reports()->activeReports()->take(1)->exists();
Activity icon

Awarded Best Reply on Override The Email Notification For Verifying Email

use Illuminate\Auth\Notifications\VerifyEmail;

You did not import it so it's searching VerifyEmail in App\Providers

Activity icon

Replied to Blade, Set Input Value To Old(), $user Or Empty

I was under the assumption that your form was behind an auth middleware.

If it isn't the case you should test if you have an auth user.

$company_name = Auth::check() ? Auth::user()->company_name : '';
Activity icon

Replied to Blade, Set Input Value To Old(), $user Or Empty

If default is null and you don't have an old vaue , the input will be empty.

Activity icon

Awarded Best Reply on Blade, Set Input Value To Old(), $user Or Empty

old() has a default value.

so

<input type="text" class="form-control" name="company_name" value="{{ old('company_name', Auth::user()->company_name) }}">
Activity icon

Replied to Blade, Set Input Value To Old(), $user Or Empty

old() has a default value.

so

<input type="text" class="form-control" name="company_name" value="{{ old('company_name', Auth::user()->company_name) }}">
Activity icon

Replied to Override The Email Notification For Verifying Email

use Illuminate\Auth\Notifications\VerifyEmail;

You did not import it so it's searching VerifyEmail in App\Providers

Mar
12
2 months ago
Activity icon

Replied to Downsides Of Testing With SQLite?

If I remember correctly SQLite doesn't support RIGHT JOINso that might be a problem for you.

Activity icon

Awarded Best Reply on Is It Possible To Run Db:seed When Using SQLite In Memory With Phpunit?

TestCase has a method (from InteractsWithDatabase trait) for it that simply call php artisan db:seed

combining it with the setUp method you can do this.

public function setUp()
{
    parent::setUp();
    $this->seed();
}

https://laravel.com/docs/7.x/testing#artisan-test-runner just scroll a bit up for the Doc about setUp

Activity icon

Replied to Is It Possible To Run Db:seed When Using SQLite In Memory With Phpunit?

TestCase has a method (from InteractsWithDatabase trait) for it that simply call php artisan db:seed

combining it with the setUp method you can do this.

public function setUp()
{
    parent::setUp();
    $this->seed();
}

https://laravel.com/docs/7.x/testing#artisan-test-runner just scroll a bit up for the Doc about setUp

Activity icon

Replied to Does Laravel Need CAPTCHA

It is not mandatory there's other ways.

see this article for some good ideas easy to implement.

https://laravel-news.com/form-spam-prevention

Activity icon

Awarded Best Reply on Post Code Screenshots In My Posts

Write your code between these : ```

// Code here

Code

Activity icon

Replied to Check If A Particular JSON Index Is Available Or Not

Use in operator (if it's javascript)

if ('key' in json)
Activity icon

Replied to Post Code Screenshots In My Posts

Write your code between these : ```

// Code here

Code

Activity icon

Replied to Mysql Trigger For Login Form

What is the problem ?

If you want to do it through a trigger, do it.

Activity icon

Replied to Which Relationship Would Be Proper Between "Post" And "Commenters"?

Your comments table acts as a pivot between postsand users.

This should work perfectly

    public function commenters()
    {
        return $this->belongsToMany(User::class, Comment::class);
    }

This is assuming your naming conventions are correct.

And be careful

$comment->belongsTo(Post:class);  // Mising one colon
$comment->belongsTo(Post::class);  // Should be this
Mar
11
2 months ago
Activity icon

Replied to How Do I Fix This Error Been Stuck On This Error Since Yesterday For My Update Function Where I'm Trying To Update A Prescription SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'carer_id' Cannot Be Null (SQL: Update `managements` Set `carer_

Well if you don't intend letting the user change the Carer, just don't update it.

        $managements->update([
        "patient_id" => $request->get('patient_id'),
       "doctor_id" => $request->get('doctor_id'),
       "medicine_id" => $request->get('medicine_id'),
       "schedule_id" => $request->get('schedule_id'),
       "reference" => $request->get('reference'),
    ]);

Since the user can't change it , it won't have to be updated.

Same for patient_id, doctor_id and all your readOnlyinputs.

Activity icon

Replied to How Do I Fix This Error Been Stuck On This Error Since Yesterday For My Update Function Where I'm Trying To Update A Prescription SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'carer_id' Cannot Be Null (SQL: Update `managements` Set `carer_

You shouldn't update carer's Id in the first place , if you're not going to let your user modify this.

Here your user could change the input value in the code and your app would update it , that's a massive flaw.

Activity icon

Replied to Need To Test For Duplicate Slugs

Small mistake on the last line.

You want to assert you're missing $post2 , not $post

$this->assertDatabaseMissing('posts', $post2);

edit: oops didn't refresh the page see @piljac1 answer haha

Activity icon

Replied to Getting Value Form Array

$name=User::whereIn('id',$ap_ids)->get(); 
$apartmentname=$name->pluck('apartment_name');

Ps : re-reading this, this doesn't seem right , don't you have a table for apartments ?

Activity icon

Replied to Laravel 404 Not Found On Heroku

Make sure you configured your Nginx server correctly.

https://laravel.com/docs/7.x/deployment#server-configuration

Activity icon

Awarded Best Reply on This Test Did Not Perform Any Assertions

well yeah , you commented the line with the assertion.

    $this->get($thread->path())->assertSee($reply->body);
Activity icon

Replied to This Test Did Not Perform Any Assertions

well yeah , you commented the line with the assertion.

    $this->get($thread->path())->assertSee($reply->body);
Mar
10
2 months ago
Activity icon

Replied to Eager Load On WhereHas

Amaury's answer

Activity icon

Awarded Best Reply on Relationship User - Job , Question

Well , you don't HAVE TO , but it can be useful to be able to retrive a user's Job.

Activity icon

Replied to Relationship User - Job , Question

Well , you don't HAVE TO , but it can be useful to be able to retrive a user's Job.

Activity icon

Replied to Cant Upgrade Laravel To 7 Globaly

The log is pretty clear :

- symfony/console v5.0.4 requires php ^7.2.5 -> your PHP version (7.4.0) overridden by "config.platform.php" version (7.2) does not satisfy that requirement.

check your composer.json file for

// ...
"config": {
    "platform": {
        "php": "7.2"
    }
},
// ...

and bump it to 7.4 since your php installation is 7.4

Mar
09
2 months ago
Activity icon

Replied to Validating Unity Files

Didn't see that you had a mimetype of "inode/x-empty"

What did you put in the ddto get this result , just curious.