Nakov

at SOLID Solutions

Member Since 5 Years Ago

Skopje

Experience Points
881,180
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
1996
Lessons
Completed
Best Reply Awards
1129
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
881,180 XP
Apr
24
3 weeks ago
Activity icon

Replied to Get Data

Shouldn't it be:

{{ $absent->teacher->user->name }}

or you have guru method in your Absen model?

Mar
28
1 month ago
Activity icon

Replied to Send Notification Id To Mailable Class

Here you go: https://stackoverflow.com/a/61858293/1457270

Have you tried accessing it using $this->id ?

As the Notification class that you are extending has a public $id property.

Mar
21
1 month ago
Activity icon

Replied to How To Redirect To Login Page When 419 Error

@binggle this worked for me on Laravel 8:

in your App\Exceptions\Handler.php class, within the register() method, add the following:

$this->renderable(function (\Exception $e) {
    if ($e->getPrevious() instanceof \Illuminate\Session\TokenMismatchException) {
        return redirect()->route('login');
    };
});
Mar
08
2 months ago
Activity icon

Replied to Route Naming

Hey, this answer should help https://stackoverflow.com/a/41416514/1457270

there is no official convention for that I think.

Mar
07
2 months ago
Activity icon

Replied to How To Create API Login Attempts

What you are looking for is called Rate Limiter.

If you open the App/Http/Kernel.php class you'll see that a throttle middleware is applied to the api route groups as well.

You can still apply the middleware to your route directly:

Route::post('login' ... )->middleware('throttle:60,1');

this means that it will allow 60 requests, and then block any future request for 1 minute, in which case 429 error response will be returned.

Here is a good article as well

https://medium.com/swlh/laravel-rate-limiting-in-production-926c4d581886

Mar
06
2 months ago
Activity icon

Awarded Best Reply on Yajra Datatable - Hide Column?

Yes you can do it dynamically.. so here is the way you should have it initialized and then play with toggling depending on how you want to trigger the show/hide.. I am using checkboxes in such case, so here is an example:

let dataTable = $('#data_table').DataTable({ ..... your options here });
let column = dataTable.column(0); // here is the index of the column, starts with 0
column.visible(false); // this should be either true or false
Activity icon

Replied to Yajra Datatable - Hide Column?

Yes you can do it dynamically.. so here is the way you should have it initialized and then play with toggling depending on how you want to trigger the show/hide.. I am using checkboxes in such case, so here is an example:

let dataTable = $('#data_table').DataTable({ ..... your options here });
let column = dataTable.column(0); // here is the index of the column, starts with 0
column.visible(false); // this should be either true or false
Mar
03
2 months ago
Activity icon

Awarded Best Reply on ErrorException: Undefined Index: Data In ../app/Widgets/TopMenu.php:23

Yeah, but make sure that before you return the view() you have the data available.

$listFilter = $SDKInstance->getFilterList();

$result = null;
if (isset($listFilter['errors'])){
     // do something with the errors
   $result = // store the errors and present them in the view or something
} 
else
{
    // all good so here you should have `$listFilter['data']` available.
   $result = $listFilter['data']['categories'];
}
       
return view("widgets.top_menu", [
       'categories' => Categorymodel::archives(),
       'blacklabelFilter' => $result
]);
Mar
02
2 months ago
Activity icon

Replied to Blade, Old() For An Array Input

The index is missing I believe, so this should work:

@foreach ($financements[config('lbpf.financement.salarial')] as $index => $financement)

        <input class="lbpf-financement lbpf-financement-salarial text-right" type="text" name="financement_salarial_details[{{ $financement->id }}][montant]" value="{{ old('financement_salarial_details.' . $index . '.montant', $financement->montant) }}" placeholder="Saisir un montant" />

@endforeach

something like this?

Activity icon

Replied to ErrorException: Undefined Index: Data In ../app/Widgets/TopMenu.php:23

Yeah, but make sure that before you return the view() you have the data available.

$listFilter = $SDKInstance->getFilterList();

$result = null;
if (isset($listFilter['errors'])){
     // do something with the errors
   $result = // store the errors and present them in the view or something
} 
else
{
    // all good so here you should have `$listFilter['data']` available.
   $result = $listFilter['data']['categories'];
}
       
return view("widgets.top_menu", [
       'categories' => Categorymodel::archives(),
       'blacklabelFilter' => $result
]);
Activity icon

Replied to ErrorException: Undefined Index: Data In ../app/Widgets/TopMenu.php:23

So there you go. Seems like the request was not successful, so you get error and not the wanted response.

So use this instead:


if (isset($listFilter['errors']))
 // do something with the errors
else
// all good so here you should have `$listFilter['data']` available.
Activity icon

Replied to Solved

Why is there a jQuery error? Are you using jQuery within your Vue components? Separate them and everything should be good.

Activity icon

Replied to ErrorException: Undefined Index: Data In ../app/Widgets/TopMenu.php:23

Obviously the error lies here $listFilter['data'] so why the isset() didn't helped? How did you use it?

try dumping out what you have in the filter using dd($listFilter) and you will see if you have 'data' item in the array, as long as the variable also is an array.

Activity icon

Replied to Solved

In order to get rid of the message you need as the error says an element with that id..

so in the body add this:

<div id="app"></div>
Activity icon

Awarded Best Reply on How To Get Route Parmeter In FormRequest ?

@ajvanho try this:

$id = $this->route('id');
Activity icon

Replied to How To Get Route Parmeter In FormRequest ?

@ajvanho try this:

$id = $this->route('id');
Mar
01
2 months ago
Activity icon

Awarded Best Reply on ErrorException Undefined Index: Current_asset_position_name In Laravel API

It is there on the first couple of iterations, but probably somewhere down the line it is missing. You can always fall back to a default value like this:

{{ $value['current_asset_position_name'] ?? '' }}
Activity icon

Replied to ErrorException Undefined Index: Current_asset_position_name In Laravel API

It is there on the first couple of iterations, but probably somewhere down the line it is missing. You can always fall back to a default value like this:

{{ $value['current_asset_position_name'] ?? '' }}
Activity icon

Replied to Check For Access In A Controller

This is the best way: https://laravel.com/docs/master/authorization#writing-policies

Read the full page for the Authorization.

Feb
24
2 months ago
Activity icon

Replied to Pressing Space Bar When Watching A Video

If you press ? when the video is in focus, it will show you all the shortcuts. That being said, the Play/Pause shortcut is not listed there, but indeed is the space key, as long as your LAST focus was on the video. If you selected another element afterwards or clicked somewhere else on the page, the video is no longer the focused element and hence the space will scroll the page down. Press on the video, and once it pauses try pressing space again you'll see that the video will continue playing.

And btw, on YouTube is the same, k letter is Play/Pause option, and not the Space button unless again the focus is on the video itself, then the Space can be used too.

Activity icon

Awarded Best Reply on Laravel Factory Unknown Column '0'

And how does your ProductColor model looks like? What do you have in the $fillable array?

Do you have name only?

Activity icon

Replied to Laravel Factory Unknown Column '0'

And how does your ProductColor model looks like? What do you have in the $fillable array?

Do you have name only?

Feb
23
2 months ago
Activity icon

Replied to Laravel Form Collective Select Option For Edit Selected

@webdevelop the value of this 'selected' should be an ID from your User, and not selected as a word, as that does nothing.

So if you have an option <option value="1">User Name</option> that param should be 1 in order for that user to be selected.

Feb
21
2 months ago
Activity icon

Replied to How We Send Customer Data In Laravel Excel Collection Or Model

So you can pass the data in the constructor of the class:

class LeadsImport implements ToModel
{

    protected $data;

    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
    * @param array $row
    *
    * @return \Illuminate\Database\Eloquent\Model|null
    */
    public function model(array $row)
    {
      // use $this->data here.

        return new Lead([
            'title' => $row[0],
            'first_name' => $row[1], 
            'user_id' =>’need here user id‘
        ]);
    }
}

of course than you need new LeadsImport($CUSTOMER_DATA) to be passed.

Feb
20
2 months ago
Activity icon

Awarded Best Reply on Select Relationship Not Working Returning Null

You have to add it in the first select:

PaymentMethod::select('name', 'slug', 'payment_method_category_id')
            ->with(['category' => function($query){
                $query->select('id', 'name')->where('status', 1);
            }])->get();

In order to use eager loading using with() the foreign key has to be selected. I noticed from the relationship that the column is named payment_method_category_id make sure that's the right one in your payment methods table.

Activity icon

Replied to Laravel Helper Func

You can always ask Google as well :)

https://www.php.net/manual/en/function.htmlspecialchars-decode.php

There are examples in the documentation too.

Activity icon

Replied to Laravel Helper Func

with a lot of magic. I would suggest that you don't use the limit on an HTML, it makes no sense. You can probably apply some CSS styling to hide part of it, but don't use limit.

Activity icon

Replied to Laravel Helper Func

And what do you mean it does not work? Do you still see the HTML tags? Maybe your HTML gets broken because at the 100th character the closing attributes are not included.. like you have <p>asdsadas MORE THAN 100 chars and then the </p> is somewhere after that, of course it will not display it correctly.

Activity icon

Replied to Cast Date Attribute On Model Property Not Work?

@abkrim have you tried datetime since the deleted_at field is a datetime type, and as the docs say:

'deleted_at' => 'datetime:d/m/Y',

https://laravel.com/docs/master/eloquent-mutators#date-casting

And the docs say this as well

When defining a date or datetime cast, you may also specify the date's format. This format will be used when the model is serialized to an array or JSON.

Note the last part, only when serialized to array or JSON.

Feb
19
2 months ago
Activity icon

Replied to Select Relationship Not Working Returning Null

You have to add it in the first select:

PaymentMethod::select('name', 'slug', 'payment_method_category_id')
            ->with(['category' => function($query){
                $query->select('id', 'name')->where('status', 1);
            }])->get();

In order to use eager loading using with() the foreign key has to be selected. I noticed from the relationship that the column is named payment_method_category_id make sure that's the right one in your payment methods table.

Activity icon

Replied to Select Relationship Not Working Returning Null

Add the category_id in the list too:

$query->select('id', 'name', 'payment_method_category_id')

and see if it works :)

Feb
18
2 months ago
Activity icon

Replied to Email Verification Not Working In Laravel Jetsream

Have you tried clicking the link in the email while you are still logged in? Are you using the same browser for both registration and the email verification?

Feb
17
2 months ago
Activity icon

Replied to ID Of Parent Object

@sarahs74 it is good to check the documentation from time to time, because really everything is very well written there, and that's the way to learn something. The discussion forum is good to help you in something that you are stucked at, but it is not good for learning as much, as tomorrow you will ask the same questions.

So now for your issue, that's called a Resource controller, and these are the methods generated out of it https://laravel.com/docs/master/controllers#actions-handled-by-resource-controller

and you can check that using php artisan route:list so in your case the expected parameter will be {bill} and in your case you are expecting property which is null since it is never passed.

So in case you have a select element with name="property_id" than you can do the following in the controller:

$property = Property::findOrFail($request->property_id);

$property->bills()->create($attributes);

and remove $property from the method signature.. I hope you follow what I am saying here, it is all in good intentions.

Activity icon

Replied to ID Of Parent Object

Since you are using the Route model binding, you can have the method like this:

public function create(Request $request, Property $property)
{
    Bill::create([
        ...
       'property_id' => $property->id,
    ]);
  
}

Make sure that you have property_id in your $fillable array of the Bill model. Or if you have the relationships setup correctly, this would work too:

$property->bills()->create($request->only(....));

Many ways.

Feb
16
3 months ago
Activity icon

Replied to Laravel- Blade How To Output HTML Tag In Double Curly Braces?

@nickywan123 you need to use {!! !!} syntax to escape the encoding. But make sure the content that you get is safe to do so.

        {!! Share::page('www.google.com')->facebook() !!}
Feb
14
3 months ago
Activity icon

Awarded Best Reply on Laravel Get A Json Value Which Has An Space

@ilhamzacky

try this:

dd(json_decode($QuestionnaireResultsSelf)->json->data->{"Tob2: SmokeNow"});
Activity icon

Replied to Laravel Get A Json Value Which Has An Space

@ilhamzacky

try this:

dd(json_decode($QuestionnaireResultsSelf)->json->data->{"Tob2: SmokeNow"});
Feb
13
3 months ago
Activity icon

Replied to Email Auth Body Text

Same rules apply my friend.. there is so much on the internet already, just do a quick search.. Here is a blog post as well

https://laraveldaily.com/mail-notifications-customize-templates/

and there is always the very good documentation, just spend some time reading, that's the way to learn.

Feb
12
3 months ago
Activity icon

Replied to New Valet Install Of Jetstream Produces Class "Laravel\Fortify\Features" Not Found Error

Things I would check are

  • Did it really installed the Jetstream package by going through the directories manually ie vendor/laravel/fortify/ and in there there should be Features.php class in the src folder.
  • I would run php artisan serve and open the URL there just in case.

  • Make sure also using valet links your url points to the correct directory in which you are installing packages.

Nothing sarcastic here, just trying to share with you my process :)

Activity icon

Replied to Production.ERROR: InvalidArgumentException: Data Missing In Laravel

And you see that your $request->date_of_birth is returning null for some reason?

So debug your request data first and make sure you have a field with name="date_of_birth" in your form.

Before you create you can use dd($request->all()); and inspect the data. :)

Activity icon

Replied to How To Get The Current Authenticated User Model Instance?

The user is already fetched, so you need to load the organization only. But anyway it will make an additional query:

return auth()->user()->load('organization');
Feb
11
3 months ago
Activity icon

Replied to Upgrade L7: Where Is The Symfony Console File ?

Just created a command using php artisan make:command and this is the initial handle method:

/**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        return 0;
    }

Maybe the STUB is not updated for your version, but I am 100% that that was the change. So @return int indicates what the response from the command should be.

Activity icon

Replied to Upgrade L7: Where Is The Symfony Console File ?

That's for custom commands that you have created. So check in your app/Console/Commands directory, if you have one, and there are custom commands that you have created using php artisan make:command only then you need to apply this to the handle methods in those commands. Otherwise just skip it :)

Feb
10
3 months ago
Activity icon

Awarded Best Reply on Date Format

You are looking for this format 'd F Y'

Activity icon

Replied to Date Format

You are looking for this format 'd F Y'

Feb
04
3 months ago
Activity icon

Awarded Best Reply on InvalidArgumentException: The Separation Symbol Could Not Be Found

Why do you need to transform the date twice?

And the error shows you what the issue is.. in your mutator of the model, you use this one:

Carbon::createFromFormat('d-m-Y', $value);

while the error says that the value is already in Y-m-d format.

You could check as well if the date is already a Carbon instance then don't do anything:

public function setDateOfBirthAttribute($value)
{
    if (!$value instanceof Carbon\Carbon)
    {
        $this->attributes['date_of_birth'] = Carbon::createFromFormat('Y-m-d', $value);
    }
}

so notice the format is Y-m-d not d-m-Y. If you want to return it in a specific format then you use :

\Carbon\Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($value))->format('d-m-Y');

Community Pillar

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