tisuchi

Software Developer at GLEIF

Member Since 6 Years Ago

Frankfurt, Germany

Experience Points
786,935
Total
Experience

0 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
1881
Lessons
Completed
Best Reply Awards
722
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 50
786,935 XP
Apr
28
1 week ago
Activity icon

Replied to Conditional Search Query

@wakanda Just to fix the typo on @tykus comment.

It should be -

->when($this->categoryId

instead of -

->when($this->$categoryId
Apr
24
2 weeks ago
Activity icon

Replied to Redirect Not Authanticated User

@mecjos You can keep the both option like that way.

    public function redirectTo($request)
    {
        if ($request->expectsJson()) {
            return response()->json(['error' => 'Unauthenticated.'], 401);
        }
    
        return route('login');
    }
Activity icon

Replied to Laravel: Order Query Using Relationship

@fcode

User.php

    public function contents()
    {
        return $this->hasMany(Content::class)->orderBy('updated_at');
    }

Content.php

    public function user()
    {
        return $this->belongsTo(User::class);
    }

Now, in the controller, you can write the query like this way-

// Getting all latest contents of user ID = 1
$contents = User::with('contents')->findOrFail(1);

// Getting all latest contents of user ID = 1
$contentsInLast24Hours = User::with('contents', function ($query) {
    $query->where('created_at', '>=', now()->subDay(1));
})->findOrFail(1);
Apr
23
2 weeks ago
Activity icon

Replied to Edit Section

@johny-22 Haha... No worries. That should be fine as long as the answer solves your issue. I am happy to see that. :)

Activity icon

Replied to Edit Section

@johny-22 Ideally YES. It is better to have two separate methods for two separate functionalities. It will give you better code tracking, idea approach for testing, and easy to read.

My opinion will go with separate functionalities.

Activity icon

Replied to Purpose Of HTMLPurifier In Laravel

@amit028

As I was building this new Kuztek site I wanted to build it to the same standards I would if I were building it for any client and that means protecting the site from malicious code or security threats. I may be the only one adding content to this site or modifying what is in the database, but filtering what we are outputting to the browser to make sure it doesn’t harm the site or our users just makes sense. We don’t want to leave our sites vulnerable to Cross-Sites Scripting(XSS). This tutorial covers Laravel customization and is intended to be used by developers to improve their site security.

When using Laravel Blade templates we typically would output content doing something like this:

Hello, {{ $name }}. 

The double curly brackets used in Blade indicate that the content will be escaped and any html code that would have been outputted will be removed automatically. But what if we want some html to come through from our database but not anything that would be a security risk? We searched around for some existing code to do the job because writing something from scratch could take a lot of time. Enter HTMLPurifier, a well maintained tool that cleans up code and even fixes things like missing html tags or illegal html nesting. To get HTMLPurifier into our Laravel project we used a handy package from MeWebStudio and added it to our site using composer.

Ref: https://kuztek.com/blog/use-laravel-purifier-security#:~:text=Enter%20HTMLPurifier%2C%20a%20well%20maintained,tags%20or%20illegal%20html%20nesting.

Apr
22
2 weeks ago
Activity icon

Awarded Best Reply on Adding A Div Row For A New Row In Laravel

@trifek The easiest way would be the make a row and then dividend into two columns inside the col-6 class. Then duplicate your code.

<div class="col-6">
  <div class="row">
    <div class="col-6">
        <div class="form-check py-2">
          <input id="productIngredientId-{{ $productIngredient->id }}"
                 class="form-check-input enableInput" style="margin-top:10px"
                 name="productIngredient[]" type="checkbox"
                 value="{{ $productIngredient->id }}"
                 @if($selectedProductIngredients->contains('ingredient_id', $productIngredient->id) === true) checked @endif>
          <label class="form-check-label" for="flexCheckChecked">
              {{ $productIngredient->name }} [{{ $productIngredient->short_name }}]
          </label>
          <input id="productIngredient-{{ $productIngredient->id }}" type="text"
                 name="productIngredient-{{ $productIngredient->id }}" maxlength="10"
                 class="form-control weight-input weightMask"
                 style="width:100px;display: inline; margin-left:20px" placeholder=""
                 value="{{ $weight }}">
      </div>
    </div>
    <div class="col-6">
        <div class="form-check py-2">
          <input id="productIngredientId-{{ $productIngredient->id }}"
                 class="form-check-input enableInput" style="margin-top:10px"
                 name="productIngredient[]" type="checkbox"
                 value="{{ $productIngredient->id }}"
                 @if($selectedProductIngredients->contains('ingredient_id', $productIngredient->id) === true) checked @endif>
          <label class="form-check-label" for="flexCheckChecked">
              {{ $productIngredient->name }} [{{ $productIngredient->short_name }}]
          </label>
          <input id="productIngredient-{{ $productIngredient->id }}" type="text"
                 name="productIngredient-{{ $productIngredient->id }}" maxlength="10"
                 class="form-control weight-input weightMask"
                 style="width:100px;display: inline; margin-left:20px" placeholder=""
                 value="{{ $weight }}">
      </div>
    </div>
  </div>
</div>
    
Activity icon

Awarded Best Reply on How To Attach Different Files Via Emails?

@user1980 Try this-


return $this->view('emails.myDemoMail')
            ->attach(public_path('pdf/sample.pdf'), [
                 'as' => 'sample.pdf',
                 'mime' => 'application/pdf',
            ])->attach(public_path('other/file/type.dox')
            ])->attach(public_path('other/file/type.ppt');

Check more: https://laravel.com/api/8.x/Illuminate/Mail/Mailable.html#method_attach

Activity icon

Replied to Help Me Please

@momoyem You should mark @frankielee reply as the best answer since it helps you to figure it out.

Activity icon

Replied to I Need An Advice On Consuming Sports API

@simonangatia If it fetches data from the API, then why not consider VUE side to render it. Unless you have to store data inside the DB.

I may use this approach.

Activity icon

Replied to How To Pass Arguments To Seeder Laravel 7x

@amireix Have you tried this?

You can set it up this way:

public function run($count = 1)

And then you can pass the argument this way:

$this->call(ClientSeeder::class, false, ['count' => 500]);

Ref: https://stackoverflow.com/questions/59077308/passing-a-quantity-or-other-arguments-to-a-laravel-seeder

Activity icon

Replied to How To Attach Different Files Via Emails?

@user1980 Try this-


return $this->view('emails.myDemoMail')
            ->attach(public_path('pdf/sample.pdf'), [
                 'as' => 'sample.pdf',
                 'mime' => 'application/pdf',
            ])->attach(public_path('other/file/type.dox')
            ])->attach(public_path('other/file/type.ppt');

Check more: https://laravel.com/api/8.x/Illuminate/Mail/Mailable.html#method_attach

Activity icon

Replied to Adding A Div Row For A New Row In Laravel

@trifek The easiest way would be the make a row and then dividend into two columns inside the col-6 class. Then duplicate your code.

<div class="col-6">
  <div class="row">
    <div class="col-6">
        <div class="form-check py-2">
          <input id="productIngredientId-{{ $productIngredient->id }}"
                 class="form-check-input enableInput" style="margin-top:10px"
                 name="productIngredient[]" type="checkbox"
                 value="{{ $productIngredient->id }}"
                 @if($selectedProductIngredients->contains('ingredient_id', $productIngredient->id) === true) checked @endif>
          <label class="form-check-label" for="flexCheckChecked">
              {{ $productIngredient->name }} [{{ $productIngredient->short_name }}]
          </label>
          <input id="productIngredient-{{ $productIngredient->id }}" type="text"
                 name="productIngredient-{{ $productIngredient->id }}" maxlength="10"
                 class="form-control weight-input weightMask"
                 style="width:100px;display: inline; margin-left:20px" placeholder=""
                 value="{{ $weight }}">
      </div>
    </div>
    <div class="col-6">
        <div class="form-check py-2">
          <input id="productIngredientId-{{ $productIngredient->id }}"
                 class="form-check-input enableInput" style="margin-top:10px"
                 name="productIngredient[]" type="checkbox"
                 value="{{ $productIngredient->id }}"
                 @if($selectedProductIngredients->contains('ingredient_id', $productIngredient->id) === true) checked @endif>
          <label class="form-check-label" for="flexCheckChecked">
              {{ $productIngredient->name }} [{{ $productIngredient->short_name }}]
          </label>
          <input id="productIngredient-{{ $productIngredient->id }}" type="text"
                 name="productIngredient-{{ $productIngredient->id }}" maxlength="10"
                 class="form-control weight-input weightMask"
                 style="width:100px;display: inline; margin-left:20px" placeholder=""
                 value="{{ $weight }}">
      </div>
    </div>
  </div>
</div>
    
Apr
21
2 weeks ago
Activity icon

Replied to Record Videos From Dusk Tests

@paulomanrique I am afraid that, you cannot do this out of the box. The only solution would be just a screen record!

Activity icon

Replied to Eloquent Query That Returns From The DB Only Rows That ‘sku’ = Array

@swimmer Try whereIn().

$sku_to_update = ['5','1','20'];

$sku_to_update = Sku::whereIn('sku', $sku_to_update)->get();
Activity icon

Replied to Laravel Query Problem.

@jarjis What I can suggest you inspect your query locally that it behaves as expected.

You just install Laravel Debugbar to inspect your app.

Activity icon

Replied to Laravel Query Problem.

@jarjis The following example may help you to understand how MySqli and PDO fetch data.

MySQLi

$stmt = $mysqli->prepare("SELECT id, name, age FROM myTable WHERE name = ?");
$stmt->bind_param("s", $_POST['name']);
$stmt->execute();
$arr = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
if(!$arr) exit('No rows');
var_export($arr);
$stmt->close();

PDO

$stmt = $pdo->prepare("SELECT * FROM myTable WHERE id <= ?");
$stmt->execute([5]);
$arr = $stmt->fetchAll(PDO::FETCH_ASSOC);
if(!$arr) exit('No rows');
var_export($arr);
$stmt = null;

Read more: https://websitebeaver.com/php-pdo-vs-mysqli

Activity icon

Replied to Target Class [env] Does Not Exist.

@foks Are you still getting the same error?

Activity icon

Replied to Target Class [env] Does Not Exist.

@foks Try this-

php artisan config:cache --env=testing

and

php artisan config:clear
Apr
20
2 weeks ago
Activity icon

Replied to Where To Consume Rabbitmq Messages

@mohafiz It's hard to get the direct resource. But you can get some ideas from this tutorial. It was helpful for me.

https://www.youtube.com/watch?v=R8pMwciZ95U

Activity icon

Replied to How To Make Multiple Filter Search In Laravel 8

@jerem-d Instead of where, why not you use orWhere()?

Besides. you can take a look this article to gain better understanding: https://dev.to/mehdifathi/making-the-advanced-query-filter-with-eloquent-filter-in-laravel-3m5l

Apr
19
2 weeks ago
Activity icon

Replied to Grouping By And Then Getting First Of A Sub Group.

@skoobi Show your code that you have so far?

Activity icon

Awarded Best Reply on You Can Remove This

@saraswat19 unfortunately, there is a no option to delete a question from Laracasts forum.

Activity icon

Replied to Invalid Argument Supplied For Foreach()

@mehrdad70 What if you tried this?

@foreach(json_decode($tag->tag_name, true) as $value)
...

Activity icon

Replied to Invalid Argument Supplied For Foreach()

@mehrdad70 Can you show exactly what is the actual json format that you have stored in the db?

Apr
18
2 weeks ago
Apr
16
3 weeks ago
Activity icon

Awarded Best Reply on Store Data In Foreach Loop In Laravel

@fajar You better wrap your form by foreach(). And you need to add <button type="submit">. It should work then.

@foreach($siswas as $siswa)
    <form action="{{route('simpan-data.absensi-siswa')}}" method="post">
        @csrf

        <tr>
            <td>
                
                {{$siswa->user->name}}
            </td>
            <td>
                <div class="form-group">
                    <input type="text" name="absen" id="" class="form-control">
                </div>
            </td>
            <td><button type="submit" class="btn btn-info btn-sm">Absen</button></td>
        </tr>
    </form>    
@endforeach

Activity icon

Replied to Eloquent Search In Array With Array

@kidi You better show what you have tried. It may gain a better understanding for everyone to try.

Activity icon

Replied to Store Data In Foreach Loop In Laravel

@fajar You better wrap your form by foreach(). And you need to add <button type="submit">. It should work then.

@foreach($siswas as $siswa)
    <form action="{{route('simpan-data.absensi-siswa')}}" method="post">
        @csrf

        <tr>
            <td>
                
                {{$siswa->user->name}}
            </td>
            <td>
                <div class="form-group">
                    <input type="text" name="absen" id="" class="form-control">
                </div>
            </td>
            <td><button type="submit" class="btn btn-info btn-sm">Absen</button></td>
        </tr>
    </form>    
@endforeach

Apr
10
4 weeks ago
Activity icon

Awarded Best Reply on How To Use Helper Function Directly In Blade In Laravel 6

@nafeeur10 I don't know exactly how did you register your helper.

Follow this document. It may help you.

https://medium.com/@razamoh/create-own-custom-helper-functions-classes-in-laravel-e8d2f50ff38

Apr
09
4 weeks ago
Activity icon

Replied to What Technology To Use For A New Project?

@new-2-lara It always depends on your preferences. As of my understanding from your points, you can either choose wordpress (where you don't have to write code literally) OR use laravel where you could have a lot of flexibility for implementation.

Side Note: For using laravel you may need good knowledge of PHP (OOP).

Activity icon

Replied to Collection Replace ?

@ajvanho I guess you don't need to use collection here if it is an array. You can try this-

    $lists = [
        "key" => "7beqbabdHqdd3NMZ",
        "attributes" => [
            "url" => "GitHub",
            "name" => "https://github.com/foo"
        ]
    ];

    $replacedValues = [
        "name" => "GitHub",
        "url" => "https://github.com/foo",
    ];

    $finalOutput = array_replace($lists, $replacedValues);

Apr
04
1 month ago
Activity icon

Replied to Get User Phone Number Using Wechat API

@jkrantz It seems it's possible. Have you checked this post? https://programmersought.com/article/66685893412/

Mar
28
1 month ago
Activity icon

Replied to How I Reflector My Code

@austinbryan Welcome to the Laravel World.

Honestly, as long as your code works, there is nothing wrong with that. But there are a lot of ways to improve your code. I believe it's all about fundamental parts.

I would recommend you to watch this series.

https://laracasts.com/series/code-reflections

Mar
23
1 month ago
Activity icon

Awarded Best Reply on Create Internal Links On Website

@mbo You may not get the exact plugin on Laravel.

But what I suggest you that, since you know already what to build is just build from the sketch. That will help you to improve the knowledge!

Community Pillar

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