Nakov

Nakov

Member Since 3 Years Ago

Skopje

at SOLID Solutions

Experience Points 212,490
Experience Level 43

2,510 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 1454
Lessons
Completed
Best Reply Awards 116
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

18 Jul
1 day ago

Nakov left a reply on Route Facade Vs $router Variable

in Laravel it used to be the same when routes.php file was used to define your routes, now as they separated the routes in web.php and api.php for convenience the facade is used.

Nakov left a reply on [Edited] How To Solve 419 Status Code On Axos POST, PATCH

You are not importing the Form my friend and you are trying to use it. I bet that you have lots of errors in your browser console saying that you are missing some resources. The get works because you are using axios.get directly, if you use axios.post it will work the same. You should add:

import Form from './utilities/Form'

after your <script> tag in order to create an object from Form

Nakov left a reply on [Edited] How To Solve 419 Status Code On Axos POST, PATCH

You need to import the Form you are trying to make an instance of a code that does not exist... So you are missing import Form from '../Form' or whatever your file is that has the Form class.

Nakov left a reply on [Edited] How To Solve 419 Status Code On Axos POST, PATCH

@successdav please provide the code from your JS Form object that you are using.

Nakov left a reply on Route Facade Vs $router Variable

In Lumen if you open bootstrap/app.php that's where the $router is being passed to the web.php script.

Nakov left a reply on Mutators And Accessors On Time Not Working

You are missing the Attribute so it should be:

public function setStartTimeAttribute($value) {
        $this->attributes['start_time'] = Carbon::parse($value)->format('hi');
}

To be considered as mutator, same for the accessors.

Nakov left a reply on Model Relationship Returns Error

Your wishlist should have a id, name, user_id and that's it. Then you will have intermediate table which will be called product_wishlist and that table will contain id of the wishlist and the product then in both models you will add belongsToMany relationship. Hope this is clearer, take a look at the link I provided in the accepted answer.

Nakov left a reply on Model Relationship Returns Error

The problem is because of the naming things, so when the method is called products it expects the column to be called products_id. So in your Wishlist model add this:

public function product()
{
    return $this->belongsTo(Product::class);
}

Because the row belongs to one product only.

Nakov left a reply on Unable To Convert Timestamps From One Timezone To Another

You are trying to convert into date using from format, if your input is as given: 10:00AM then you need to use this:

$date = Carbon::createFromFormat('H:iA', $request->opening_time, 'MST' );

Nakov left a reply on Route [calender.index] Not Defined. (View: C:\wamp64\www\ckcmain\resources\views\layouts\dashboard.blade.php)

You have a typo calender.index should be calendar.index. Change that in your dashboard.blade.php view.

17 Jul
2 days ago

Nakov left a reply on Npm Error

@david001 npm watch is not the correct command, you should try npm run watch.

Nakov left a reply on Npm Error

Is there an issue that you are facing, because I cannot see anything wrong from the output. If you doubt about the warning here is a StackOverflow answer for it.

16 Jul
3 days ago

Nakov left a reply on Return View Error

@kuns25 You can open the Browser console and you will see all the errors that you have, most of them are from the CSS and JS files that you are referencing.

You should use for each usage one of the laravel helper functions like the assets or url in order to generate the correct url for the resource. The problem is because of using relative paths to the resources.

Nakov left a reply on Return View Error

I don't know if you read above, but as I said you are using an absolute path without the prefix. Can you please share the code from your view for the image that does not work for example?

Are you using url('/images/background/Supriya-Heights.jpeg'); or just "images/background/Supriya-Heights.jpeg"?

The second one will not work is what I am saying..

Nakov left a reply on Return View Error

I am not saying the path to the view, but the paths to your resources.. which are images and so on.. You can inspect your browser console and you will see it tries to find images in the place that don't exist.

Nakov left a reply on Return View Error

The problem is because you are using wrong paths in the view for your resources. For example if you have:

img/icon/s2-icon-1.png

In your code, try to add / in front so it should become:

/img/icon/s2-icon-1.png

So the problem is in your blade view, not in the controller, just so you know.

Nakov left a reply on How To Implement Repository Pattern In Laravel

It is not old because the pattern is the same.

Nakov left a reply on Passing Link As Parameter Using Get Method

Here is the route:

Route::get('/testing', function() {
   dd(request('link'));
});

Here is the test url:

https://yoursite.test/testing?link=http://laracasts.com

And the result:

"http://laracasts.com"

Nakov left a reply on Mass Assign With Input Filter

Yes, my friend I think we don't understand each other. What I gave you above as a solution would work with just excluding the $guarded array, because if you can see I use except instead of only so the fields that are not excluded using the guarded array but exist in the table as columns will be filled. It is the same as your approach above, using getFillable only. If for a field like send_email you don't have a column in your database table it will be ignored anyway.

Nakov left a reply on How To Implement Repository Pattern In Laravel

And who said that Laracasts does not have a tutorial for it?

Repositories simplified

And here is a great series on this topic as well.

Nakov left a reply on Mass Assign With Input Filter

Do you store each of the fields in one column or each of them have separate column name? Because you can send whatever data you want but it will not be stored unless you have it in the $fillable array, and with the approach I shared above it will exclude those from the $guarded array too.

Nakov left a reply on Mass Assign With Input Filter

What about doing this instead:

$asset = new \App\Models\CmdbAssets;
$asset->create($request->except($asset->getGuarded()));
15 Jul
4 days ago

Nakov left a reply on Form Request Validation For JSON Parameter

So the json rule validates a JSON string for a valid JSON, so the data that you are sending should be like this instead:

{
    "id": 1,
    "name": "John",
    "json_data": "{\"data1\": [], \"data2\": []}"
}

Nakov left a reply on Form Request Validation For JSON Parameter

Can you please show an example request data and your validation code so we can try to help?

Nakov left a reply on Undefined Variable: Mail

You are not passing the $mail to the view, so pass the mail with your $data to the view like this:

$mail = jobapplication::where('id','=',$id)->first();
$data= array('name'=>'byteandbits', 'mail' => $mail);

Nakov left a reply on Tasks Not Found

You've misspelled project twice in your route definition:

this

Route::POST('/porjects/{porject}/tasks','[email protected]');

should be this:

Route::post('/projects/{project}/tasks', '[email protected]');
14 Jul
5 days ago

Nakov left a reply on Select Proper Value From Array Dynamically

You cannot use concatenation on the object, you can access it as using the key like this:

var locale = this.pagesettings.language_id;
// the locale here should be "en" or one of the others
return this.copyrights[locale];

Make sure that the locale returns "en", "fr" or one of those in order for this to work.

Nakov left a reply on How To Select Dropdown Using Pluck Using Foreign Key

In your Users_pro model you should have this relationship:

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

Then you can use the following:

$data= Users_pro::with('user')->get()->pluck('user.name', 'id');

Nakov left a reply on All Ajax Post Request Not Going Through

In your bootstrap.js or app.js file you should have something like this:

window.axios = require('axios');

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

let token = document.head.querySelector('meta[name="csrf-token"]');

if (token) {
    window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
    console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}

And in your main blade file, you should have this meta tag:

<meta name="csrf-token" content="{{ csrf_token() }}">

Nakov left a reply on Route Properly Defined But Still Get HTTP Exception Not Found

Then to use the named route you should directly use the underling call method like this:

$response = $this->call('post', route('courses.store'), $course->toArray());

Nakov left a reply on Route Properly Defined But Still Get HTTP Exception Not Found

And does running $this->post('/courses', $course->toArray()); works?

Nakov left a reply on Undefined Variable: Users

Please mark the answer as Best Answer my friend.

Nakov left a reply on Undefined Variable: Users

Instead of returning the view which again expects you to pass the $users you can redirect to the route like this:

// in user_destroy method

return redirect()->route('admin.users.index')->with('success','User is deleted');

Nakov left a reply on How To Bind Radio Button Values From Database In Edit Form In Laravel?

The easiest and less ugly way is to pass an empty Page instance from your controller to the page, so something like this:

$page = new Page;

return view('create', compact('page'));

This way you can avoid checks each time you want to use the page variable within the view.

Nakov left a reply on Filter Data By Checkbox

Just make each of the inputs from type="radio" to type="checkbox" then the changes in your script should be the following:

// in the data
selectedCategory: "All"

// should be this
selectedCategory: ["All"]

// and replace the filteredPeople with this:
filteredPeople: function() {
    var app = this;
    var category = app.selectedCategory;
            
    if(category.includes("All")) {
        return app.people;
    } else {
        return app.people.filter(function(person) {
            return category.includes(person.cat);
        });
    }
}
13 Jul
6 days ago

Nakov left a reply on Error In Migration

You can look at the engine, is it the same locally as it is on your Digital ocean?

Nakov left a reply on Error In Migration

I just gave you an alternative, I am using Sequel Pro too, and it gives me the info. It seems like you don't have the foreign key added at all, like an empty migration has run. Make sure that you are looking at the right database, I don't know what else to tell you. Rollback the last migration try to die and dump in the up method, make sure that it executes the code..

Nakov left a reply on Error In Migration

Have you tried from the console?

This are the steps:

  • mysql -uroot -p
  • Enter password or hit enter if no password
  • use DATABASE_NAME;
  • SHOW CREATE TABLE leads;

it will print out the syntax of your create table, and it should have KEY leads_location_id_foreign something like this.

Nakov left a reply on Error In Migration

Are you sure that the migration ran without any errors?

  • Refresh the tables in Sequel Pro so that it gives you the latest changes.
  • Re-open Sequel Pro just in case.
  • Check your migrations table and make sure that the migration exists and it ran as it should.
  • Make sure that the data type of the location_id and the id on locations table is the same, for example if in locations you have bigIncrements('id') make sure that the location_id is also an unsignedBigInteger.

Nakov left a reply on Laravel 5.7 | Display Data From Column Table In 2 Bootstrap's Column

You can use the chunk method to separate the data of the collection into two rows.

Nakov left a reply on How To Get Blade File Path?

Why don't you pass that as a parameter, I don't know the use case but I guess you have the condition within your partial file, so in one of the views you will set this:

@include('partial', ['viewX' => true])

In the other:

@include('partial', ['viewX' => false])

Then in your partial just use that:

@if($viewX)
 // do x
@else
// do y
@endif

Nakov left a reply on Multi User Authentication

I don't know what you mean by security issues, but you should better create a middleware that will check the role of the user and allow access to a group of routes. Because this way anyone knowing the routes of your admin will be able to access the pages. So either you use policy authorization to protect specific routes or middleware (which is better for a group of routes) you can handle the access for the users.

Nakov left a reply on Pass Array Of Inputs To $request Variable

You can do it like this:

$request->all(['title', 'body'])

Nakov left a reply on Unknown Custom Element

If you keep all the components in the same directory you can import them like this:

// instead of 
import Info from '@/Shared/Info'

// use
import Info from './Info'

And also in your Tab component you have a component option, which should become components even though it is one, so use this:

<script>
import Tab from './Tab'

export default {

    components: { Tab },

    mounted() {
        console.log(this.$children);
    }
}
</script>

Nakov left a reply on Argument 1 Passed To Illuminate\Mail\PendingMail::queue() Must Be An Instance Of Illuminate\Mail\Mailable, Array Given, Called In

I tried to reproduce your error by using exactly the same code as you have, and I cannot reproduce it. Are you sure that you are getting this error now, or did you had this error when you tried passing directly the array instead of the Mailable object, like this:

// this is the wrong usage
\Mail::to($email)->queue($data);

// but this is correct
\Mail::to($email)->queue(new Mailer($data));

Nakov left a reply on Argument 1 Passed To Illuminate\Mail\PendingMail::queue() Must Be An Instance Of Illuminate\Mail\Mailable, Array Given, Called In

Is your Mailer class that you are passing to the queue an instance of Illuminate\Mail\Mailable class?

Share the content of the Mailer class please? And make sure you import the correct one when you use it, because a Mailer class already exists in the framework, so use a custom, more specific name for it.

12 Jul
1 week ago

Nakov left a reply on Display Name Based On User ID

@jamesmarsh43 so if you use what I've shown you above you are good to go.

Nakov left a reply on Model Relationship Only One Column

@falloutboi I edited my answer did you tried the last one? It cannot be the same for sure, because once you get the model you will get the image property out of it.

Nakov left a reply on Model Relationship Only One Column

You get that because get() returns a collection use first() instead, but keep in mind that that can return null.

So use this:

return $this->productImages()->select('image')->where('primary','=', 1)->first() ?? 'default';