Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

Nakov

Nakov

at SOLID Solutions

Member Since 5 Years Ago

Skopje

Experience Points
789,710
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
1807
Lessons
Completed
Best Reply Awards
1013
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 50
789,710 XP
Nov
24
15 hours ago
Activity icon

Awarded Best Reply on Unable To Save To One-to-one Relation

@cosmic_learning seems like it should work. Except that you have $ missing in the parameter that you are passing. If you copy pasted your method, just fix that as well:

public function storeApiResponse(array $apiResponseData)
{
    $this->apiResponse()->create($apiResponseData);
}
Activity icon

Replied to Unable To Save To One-to-one Relation

@cosmic_learning seems like it should work. Except that you have $ missing in the parameter that you are passing. If you copy pasted your method, just fix that as well:

public function storeApiResponse(array $apiResponseData)
{
    $this->apiResponse()->create($apiResponseData);
}
Activity icon

Replied to Use Request Validation For Store And Update

You can use a conditional:

if ($this->isMethod('PUT')) {
    // update            
}

// create

and apply the rules based on the condition, or return the gate specific to the method.

Activity icon

Replied to Put An If Condition Around Where Clause In Laravel Query

You can use when() for that:

DB::table('users')->select('first_name')
	->when($city_id > 0, function($query) use ($city_id) {
            $query->where('addresses.city_id',$city_id);
        })->get();

More here: https://laravel.com/docs/8.x/queries#conditional-clauses

Activity icon

Replied to My New Data Is Not Coming In ($request->all())

Here is the same question, and read to the thread of answers it has some value in it. Your issue is not Laravel specific, it is configurable on the application server, depends on what you are using

https://stackoverflow.com/q/2364840/1457270

Nov
23
1 day ago
Activity icon

Awarded Best Reply on Livewire Making Two Rows Instead Of One.

Just remove the call to createTask from elsewhere except the form itself.

So the button becomes

<button type="submit" class="btn-main w-full" wire:loading.attr="disabled">
              <svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#fff" class="animate-spin w-5 h-5 mr-3" wire:loading >

here is an example form: https://laravel-livewire.com/docs/2.x/input-validation

Activity icon

Replied to Livewire Making Two Rows Instead Of One.

Just remove the call to createTask from elsewhere except the form itself.

So the button becomes

<button type="submit" class="btn-main w-full" wire:loading.attr="disabled">
              <svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#fff" class="animate-spin w-5 h-5 mr-3" wire:loading >

here is an example form: https://laravel-livewire.com/docs/2.x/input-validation

Activity icon

Awarded Best Reply on "Invalid Route Action" On Invokable Controller

@dimz the error says Invalid route action: [V1\App\Http\Controllers\Api\V1\Invokable\Auth\LoginController]. and the namespace there starts with V1 why? you should look for where else do you use this action, because the namespace in your controller is different than what the error says.

Activity icon

Replied to "Invalid Route Action" On Invokable Controller

@dimz the error says Invalid route action: [V1\App\Http\Controllers\Api\V1\Invokable\Auth\LoginController]. and the namespace there starts with V1 why? you should look for where else do you use this action, because the namespace in your controller is different than what the error says.

Nov
22
2 days ago
Activity icon

Awarded Best Reply on Factory With Custom Timestamps

@gamecock you can try this one:

$user = User::factory()->make();

$user->timestamps = false;
$user->created_at = now()->addMinute();
$user->updated_at = now()->addMinute();
$user->save();
Activity icon

Replied to Livewire Unhides Hidden Button

It does not make sense to me, I cannot debug it locally. Glad you found out what causes it, so just try out everything, not sure what else to say.

Activity icon

Replied to Livewire Unhides Hidden Button

Hm, I really don't think it is Chrome that overrides manually neither the style nor the hidden attribute. As you said it is Bulma most probably that applies display:visible or whatever to the class. So an id has a heavier value than a class so if you add id to the button, and then put #id_name { display:none } in your CSS, the button should be hidden, or apply the style directly on the button

<button id="butShare" style="display:none" class="button" hidden>
    <span class="icon"><i class="fa fa-share" aria-hidden="true"></i></span><span>Does not hide</span>
</button>
Activity icon

Replied to Livewire Unhides Hidden Button

Well, there you go :) apply either a class or an id that will set the display:none.

Activity icon

Awarded Best Reply on Livewire Unhides Hidden Button

@laracoft just tried this:

<div wire:poll>
    <h1>{{ now() }}</h1>
    <button hidden>Test</button>
</div>

in my project, and it works as it should. So I don't know how your hidden attribute is gone.

Activity icon

Replied to Livewire Unhides Hidden Button

Just slightly newer version of Chrome (Version 87.0.4280.67 (Official Build) (x86_64)) the rest is the same, and I am on a Mac. But this is not a way to debug it my friend.

I would comment all the other scripts just to make sure nothing is interfering with the page.

Activity icon

Replied to Factory With Custom Timestamps

@gamecock you can try this one:

$user = User::factory()->make();

$user->timestamps = false;
$user->created_at = now()->addMinute();
$user->updated_at = now()->addMinute();
$user->save();
Activity icon

Replied to Livewire Unhides Hidden Button

The browser support is also mentioned in the link that you shared with me for the attribute, so make sure you are trying on a supported browser.

Activity icon

Replied to Livewire Unhides Hidden Button

@laracoft just tried this:

<div wire:poll>
    <h1>{{ now() }}</h1>
    <button hidden>Test</button>
</div>

in my project, and it works as it should. So I don't know how your hidden attribute is gone.

Activity icon

Replied to Livewire Unhides Hidden Button

@laracoft but there is not attribute in an html element called hidden is it maybe a custom class that needs to be part of the class attribute instead?

<button id="butShare" class="button hidden">
Activity icon

Replied to Livewire Unhides Hidden Button

Are you sure it is Livewire that unhides the button, or your custom script is executed? Put a console.log within the condition and make sure that it is not your JS part that unhides the button.

Activity icon

Awarded Best Reply on Livewire Live Validation

Seems like your method is not called at all, try like this:

public function updated($propertyName)
{
    // check here what is your property name

    $this->validateOnly($propertyName);
}

or rename the method to updatedUserBadge, not update but updated instead.

Activity icon

Replied to Livewire Live Validation

Seems like your method is not called at all, try like this:

public function updated($propertyName)
{
    // check here what is your property name

    $this->validateOnly($propertyName);
}

or rename the method to updatedUserBadge, not update but updated instead.

Nov
21
3 days ago
Activity icon

Replied to Package Development - Target Class [livewire] Does Not Exist.

Maybe composer dump-autoload will solve it?

Nov
19
5 days ago
Activity icon

Awarded Best Reply on Bind Model To Existing Database Table

So you will need to define your connections within config/database.php file, and then in each model, you can include this properties:

protected $connection = 'your_connection';
    
protected $table = 'table_name';
Activity icon

Awarded Best Reply on Testing For Expected ModelNotFoundException

I had the same issue recently, got it working this way:

$this->expectException(\ErrorException::class);

Livewire::test(ShowActivity::class, ['id' => $user2Activity->id])
			->assertNotFound();

Not sure what is the right way, but this works for me.

Activity icon

Replied to Testing For Expected ModelNotFoundException

I had the same issue recently, got it working this way:

$this->expectException(\ErrorException::class);

Livewire::test(ShowActivity::class, ['id' => $user2Activity->id])
			->assertNotFound();

Not sure what is the right way, but this works for me.

Activity icon

Awarded Best Reply on Class 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' Not Found

Just installed it on Laravel 8 project and the commands are there. You should give more details on what you are doing, which command did you ran?

You should just install it as such composer require --dev barryvdh/laravel-ide-helper and let the auto-discovery do the rest.

And to refresh the autoload the command is composer dump-autoload not dum-autoload.

Activity icon

Replied to Class 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' Not Found

Just installed it on Laravel 8 project and the commands are there. You should give more details on what you are doing, which command did you ran?

You should just install it as such composer require --dev barryvdh/laravel-ide-helper and let the auto-discovery do the rest.

And to refresh the autoload the command is composer dump-autoload not dum-autoload.

Activity icon

Replied to Bind Model To Existing Database Table

So you will need to define your connections within config/database.php file, and then in each model, you can include this properties:

protected $connection = 'your_connection';
    
protected $table = 'table_name';
Activity icon

Replied to Won't Let Me Log In After Changing Password

Have you tried using forceFill instead?

$user->forceFill([
    'password' => Hash::make($request->nyttpassord)
])->save();
Nov
18
6 days ago
Activity icon

Awarded Best Reply on How To Stop Automatically Stripe Plan With Cashier

@viatori I would create a cron job that will run once a day for example, and check for which user the 6 months of subscription has passed and then just call the cancel() method on the subscription: https://laravel.com/docs/8.x/billing#cancelling-subscriptions

Activity icon

Replied to Post Url Generator

You can add a helper function within your Post model:

public function path()
{
    return $this->slug . '-' . $this->id;
}

and then just use href="{{ $post->path() }}".

Nov
17
1 week ago
Activity icon

Replied to How To Stop Automatically Stripe Plan With Cashier

@viatori I would create a cron job that will run once a day for example, and check for which user the 6 months of subscription has passed and then just call the cancel() method on the subscription: https://laravel.com/docs/8.x/billing#cancelling-subscriptions

Activity icon

Replied to Error: Illuminate\Contracts\Container\BindingResolutionException Target Class [UserSeeder] Does Not Exist.

Try running composer dump-autoload and then run again the php artisan migrate --seed.

Activity icon

Awarded Best Reply on File Uploaded But Form Not Submitted

Yup, that's how dropzone works, but you can configure it to not upload the files unless thee user submits the form.

Take a look at this answer here: https://stackoverflow.com/a/49296547/1457270

and here is the documentation details for that option: https://www.dropzonejs.com/#config-autoProcessQueue

Activity icon

Replied to File Uploaded But Form Not Submitted

Yup, that's how dropzone works, but you can configure it to not upload the files unless thee user submits the form.

Take a look at this answer here: https://stackoverflow.com/a/49296547/1457270

and here is the documentation details for that option: https://www.dropzonejs.com/#config-autoProcessQueue

Nov
16
1 week ago
Activity icon

Replied to How To Get Auth User From Oauth Token?

@niloy have you tried using the Auth facade:

Auth::('api')->user();

// or

auth('api')->user();
Activity icon

Replied to Production.ERROR: Trying To Get Property 'first_name' Of Non-object

You can do that like this:

{{$leaverequesthr->reliefofficer->first_name ?? 'Not available'}}

or just try

{{optional($leaverequesthr->reliefofficer)->first_name}}

Because it is obvious that your reliefofficer can be null.

Activity icon

Awarded Best Reply on Loop Though Array And Insert Into Db

@dk4210 you actually need to get a hold of the clients array, so you can do this:

foreach ($data['clients'] as $client)
{
    Client::create([
        'name' => $client['name'],
        'oid' => $client['oid']
    ]);
}	

I assume here that you already have an eloquent model called Client and that the rest of your database is setup properly, with the fields above, like name and oid already in the table.

Activity icon

Replied to Loop Though Array And Insert Into Db

Check your TestClient model and make sure that you have c_id in your fillable fields.

Activity icon

Replied to Loop Though Array And Insert Into Db

@dk4210 you actually need to get a hold of the clients array, so you can do this:

foreach ($data['clients'] as $client)
{
    Client::create([
        'name' => $client['name'],
        'oid' => $client['oid']
    ]);
}	

I assume here that you already have an eloquent model called Client and that the rest of your database is setup properly, with the fields above, like name and oid already in the table.

Activity icon

Replied to How To Create Php Artisan Custom Command

There is already a tool like that: https://laravel.com/docs/8.x/envoy

It won't copy over because that does not make sense having services such as github, but the rest can be automated :)

Activity icon

Awarded Best Reply on Call To Undefined Method Illuminate\Session\Store::had()

@nikhillvl somewhere in your methods that you are calling, you are trying to use Session::has but instead you use Session::had so had does not exists, change it to has.. you might be using the helper function as well, which should be session()->has() instead of session()->had().

Nov
15
1 week ago
Activity icon

Replied to Rollback Migration: Kill

there is no way to stop it unless you keep a backup from the database so you can replace it.

Or maybe just set APP_ENV=production and once you run any migration command it will ask you for confirmation, it won't do it automatically.

Activity icon

Replied to Call To Undefined Method Illuminate\Session\Store::had()

@nikhillvl somewhere in your methods that you are calling, you are trying to use Session::has but instead you use Session::had so had does not exists, change it to has.. you might be using the helper function as well, which should be session()->has() instead of session()->had().

Activity icon

Awarded Best Reply on SQLSTATE[23000]: Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row: A Foreign Key Constraint Fails (`simoneb`.`beasiswa`, CONSTRAINT `beasiswa_users_id_foreign` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`)) (SQL: Insert Into `bea

@marfino3028 you are missing users_id, you have called it user_id in your updateOrCreate call.

Change it to this:

Beasiswa::updateOrCreate(['id' => $this->id], [    
        'nama' => $this->nama,
        'deskripsi' => $this->deskripsi,
        'foto' => $foto,
        'semester' => $this->semester,
        'users_id' => $this->id
        
    ]);
Activity icon

Replied to SQLSTATE[23000]: Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row: A Foreign Key Constraint Fails (`simoneb`.`beasiswa`, CONSTRAINT `beasiswa_users_id_foreign` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`)) (SQL: Insert Into `bea

@marfino3028 you are missing users_id, you have called it user_id in your updateOrCreate call.

Change it to this:

Beasiswa::updateOrCreate(['id' => $this->id], [    
        'nama' => $this->nama,
        'deskripsi' => $this->deskripsi,
        'foto' => $foto,
        'semester' => $this->semester,
        'users_id' => $this->id
        
    ]);
Nov
14
1 week ago
Activity icon

Replied to How Do I Give An <option> Element A Selected Attribute In VueJS?

You are missing the value on the option ie :value="category.id" + you are comparing the ID to nothing, so what you are essentially doing is selecting all, in which case the first one will be selected, so you need:

:selected="category.id === categoryId"

Having categoryId in your data object, and pre-selected.

Ready more here: https://stackoverflow.com/a/43839491/1457270

Nov
13
1 week ago
Activity icon

Replied to Patch Produces 405 Error

@dasbrow maybe you introduced a new route which has the same endpoint ie /rules and that route is defined with POST method so it overrides the route that used to work before.

Checkout using php artisan route:list if you have two routes with the same endpoint with different method types.