Nakov

Nakov

at SOLID Solutions

Member Since 4 Years Ago

Skopje

Experience Points
700,150
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
1650
Lessons
Completed
Best Reply Awards
893
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
700,150 XP
Apr
06
1 day ago
Activity icon

Replied to Compare Value And Preform An Action

sorry @marlonv, I am not sure I understand your question. You can check in your database if the data is set to null if this is what you mean. Make sure that your field is also nullable.

And make sure that from your index method you get fresh data from your table. But also I don't know how your view looks, or where do you have the problem.

Activity icon

Awarded Best Reply on Compare Value And Preform An Action

@marlonv so instead of this $data(['status']) use just this $data['status'] ?

Activity icon

Replied to Compare Value And Preform An Action

@marlonv so instead of this $data(['status']) use just this $data['status'] ?

Activity icon

Replied to Laravel Scheduler Run On First Wednesday On Each Month At 9pm

Based on the documentation you should be able to do something like this:

// Run once per month on Wednesday at 9 PM...
$schedule->call(function () {
    //
})->monthly()->wednesdays()->at('21:00');

https://laravel.com/docs/7.x/scheduling#schedule-frequency-options

Let me know if this does the job :)

Activity icon

Replied to Redirect With Message If Foreign Key Violated On Delete

A try catch like here: https://stackoverflow.com/a/26371673/1457270

and in the catch just return your message.

Apr
05
2 days ago
Activity icon

Awarded Best Reply on Cashier Charge Method Results In Response::setContent Error

@bacchus is it really failing on this line, or when you try to return from the controller method?

Because if you try this:

$stripeCharge = auth()->user()->charge((int) number_format($order->total(), 0, "", ""), request('payment-id'));
dd($stripeCharge);

I believe it should return an instance of Laravel\Cashier\Payment and the problem should be when you return from the controller as this error:

Symfony\Component\HttpFoundation\Response::setContent()

comes from Laravel.

Activity icon

Replied to Cashier Charge Method Results In Response::setContent Error

@bacchus is it really failing on this line, or when you try to return from the controller method?

Because if you try this:

$stripeCharge = auth()->user()->charge((int) number_format($order->total(), 0, "", ""), request('payment-id'));
dd($stripeCharge);

I believe it should return an instance of Laravel\Cashier\Payment and the problem should be when you return from the controller as this error:

Symfony\Component\HttpFoundation\Response::setContent()

comes from Laravel.

Activity icon

Replied to Let's Build A Forum : Problem In Channel Table

The very basic idea is to check your .env file to which database you are connecting to. Maybe you have two different ones, and you are looking at the wrong one.

Apr
04
3 days ago
Activity icon

Replied to RuntimeException: Session Store Not Set On Request.

Is this a Unit or a Feature test?

Are you extending from:

use PHPUnit\Framework\TestCase;

or

use tests\TestCase;

one is PHPUnit and the other one bootstraps the Laravel app, so make sure you use the second one.

And btw, why you have withoutExceptionHandling in your test?

Activity icon

Replied to RuntimeException: Session Store Not Set On Request.

@saneesh in your phpunit.xml file there is a <php> node, add this:

<server name="APP_ENV" value="testing"/>

or create your own .env.testing file and put different variables then the ones in .env:

https://laravel.com/docs/master/testing#environment

Activity icon

Replied to RuntimeException: Session Store Not Set On Request.

@saneesh take a look at the big block note here: https://laravel.com/docs/7.x/csrf#csrf-excluding-uris

It says clearly that CSRF is automatically disabled while running tests. So yes, that is a problem I believe.

Activity icon

Replied to RuntimeException: Session Store Not Set On Request.

@saneesh and does everything works through the browser?

Did you removed anything from the RouteServiceProvider like the web middleware which is applied to the web.php file?

How does your phpunit.xml file looks like, or are you overriding any settings using the .env.testing file?

Missing:

<server name="SESSION_DRIVER" value="array"/>

from the phpunit.xml file while not providing any default from the session.php config?

Those are parts that I would check :)

Apr
03
4 days ago
Activity icon

Awarded Best Reply on Generating An Ignition Report In Laravel 7 With Abort() Not Working.

Try forcing any of the 4xx error codes which are more client errors, instead of 500 which are server errors. Even prior to ignition a 500 error will not tell you any more then "Something went wrong" so you had to look in the logs.

https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_errors

So try this instead:

abort(400, 'custom error');
Activity icon

Replied to How To View Variables?

@mbo if what you have works, then you just need to loop over the input data and add each one separately:

$inp = Input::all();

foreach($inp['file'] as $file)
{
    $destinationPath = 'storage/xxx/uploads/temp'; // upload path
    $extension = $file->getClientOriginalExtension(); // getting image extension
    $fileName = Auth::id().time().$file->getClientOriginalName(); // renameing image
    $file>move($destinationPath, $fileName); // uploading file to given path
}

Activity icon

Replied to How To View Variables?

@mbo you will not be able to get it from the input, try this instead:

public function store(Request $request)
{
      //session_start();

    if($request->has('file'))
    {
        $file = $request->file('file');
        $destinationPath = 'storage/xxx/uploads/temp'; // upload path
        $extension = $file->getClientOriginalExtension(); // getting image extension
        $fileName = Auth::id().time().$file->getClientOriginalName(); // renameing image
        $file->move($destinationPath, $fileName); // uploading file to given path

        return $fileName;
    }	


      return 'No file';
}

Here is a tutorial for more: https://makitweb.com/drag-and-drop-file-upload-using-dropzone-in-laravel/#controller

Activity icon

Replied to How To View Variables?

Why isn't this enough:

public function fileupload(Request $request){

     if($request->hasFile('file')) {

       $file = $request->file('file');

       $extension = $file->getClientOriginalExtension();
       $filename = $file->getClientOriginalName();
       dd($extension, $filename); // print the file 
      
     }
}
Activity icon

Replied to Laravel Looking For Other Controller

@eusapxai if you ran a Find and Replace you might have changed in the wrong place. Make sure that your new OrderController does not includes the bck_ in front. Also try clearing your cache:

php artisan view:clear

php artisan cache:clear
Activity icon

Replied to Where From Should Start For Learning The Vue

You can start here: https://vuejs.org/v2/guide/

And for video tutorials you have a great Journey here : https://laracasts.com/skills/javascript

Activity icon

Replied to Laravel Looking For Other Controller

@eusapxai

Make sure that your filename matches the class declaration within your file. And also make sure you are referencing the correct controller from within your web.php or api.php files.

Activity icon

Replied to Generating An Ignition Report In Laravel 7 With Abort() Not Working.

Try forcing any of the 4xx error codes which are more client errors, instead of 500 which are server errors. Even prior to ignition a 500 error will not tell you any more then "Something went wrong" so you had to look in the logs.

https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_errors

So try this instead:

abort(400, 'custom error');
Apr
02
5 days ago
Activity icon

Awarded Best Reply on Customizing Laravel Sanctum Model

Well I would not touch the vendor files.

I believe I found a way for you, but I cannot try it unfortunately.

So what I would do is create my own model:

<?php

namespace App; // your own namespace

use Laravel\Sanctum\PersonalAccessToken;

class PersonalAccessToken extends PersonalAccessToken
{
    protected $connection = 'my-connection';
}

And then just add this line in your AppServiceProvider in the boot method:

Sanctum::usePersonalAccessTokenModel(App\PersonalAccessToken::class);

This should now use your version of it. Let me know if it does the job :)

Activity icon

Replied to Error 500: Internal Server Error When $currentstatus = NULL

@noblemfd the problem is that this code:

$currentstatus = AppraisalGoal::select('is_approved')->where('employee_id', $id)->where('appraisal_identity_id', $identities->id)->where('is_published', 1)->where('id', '!=', $linemanager->line_manager_id)->first();

can return null and in your case it certainly does returns null so you need to fix your query.

If you use ->firstOrFail() instead of just ->first() you will get an immediate error from your controller. So fix your query is the answer :)

Activity icon

Replied to Customizing Laravel Sanctum Model

Well I would not touch the vendor files.

I believe I found a way for you, but I cannot try it unfortunately.

So what I would do is create my own model:

<?php

namespace App; // your own namespace

use Laravel\Sanctum\PersonalAccessToken;

class PersonalAccessToken extends PersonalAccessToken
{
    protected $connection = 'my-connection';
}

And then just add this line in your AppServiceProvider in the boot method:

Sanctum::usePersonalAccessTokenModel(App\PersonalAccessToken::class);

This should now use your version of it. Let me know if it does the job :)

Activity icon

Replied to Laravel Notifications Data Column, How To Use

@jafo232a I don't like this much. But if it works for you, good :)

Activity icon

Replied to Customizing Laravel Sanctum Model

I believe you should add the connection to your User model, since Sanctum provides just a trait which you add to your user model:

use HasApiTokens;

which then provides you the methods to create tokens, but those tokens are assigned to the user for which you are initiating the call.

Activity icon

Replied to Laravel Notifications Data Column, How To Use

@jafo232a then I believe you should separate the notifications, you cannot do it from one notification.. Just send another notification from within the toVoice one, when you get the ID, which will then store it to the database, and that's it.

Activity icon

Replied to Laravel Notifications Data Column, How To Use

You should be able to do it like this:

class YourNotification extends Notification
{
    use Queueable;

    private $twilioId;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct(twilioId)
    {
        $this->twilioId = $twilioId;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['database'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     */
    public function toArray($notifiable)
    {
        $coach = $this->item->user;

        return [
            'twilio_id' => $this->twilioId,
	    .... // other fields here
        ];
    }
}

Then call it

$user->notify(new YourNotification($twilioId));

Does this work?

Activity icon

Replied to Laravel Notifications Data Column, How To Use

I am trying to understand your question but I really can't..

You just use :

public function via($notifiable)
{
        return ['database'];
}

And whatever you have in the toArray() or in case you are using the broadcast driver then you should use toDatabase method will get stored to the database once you send a notification..

And sending a notification goes like so:

$user->notify(new YourNotification);
Activity icon

Replied to Relation Between Two Models Not Working Out

@quickenbabbage

nope, like this:

dd($data);

$post = auth()->user()->posts()->create($data); 

return redirect ('/home')

This will stop the program at that point and print out the resulting array on the screen.

Activity icon

Replied to Relation Between Two Models Not Working Out

@quickenbabbage

and before creating have you checked dd($data) if it contains a value for the subreddit?

Activity icon

Replied to Relation Between Two Models Not Working Out

@quickenbabbage

In your Post model make sure you add subreddit_id in your $fillable array unless you use $guarded = [] in order for eloquent to allow mass-assignment of columns.

Apr
01
6 days ago
Activity icon

Replied to Syntax Error, Unexpected End Of File

Missing a closing tag should be the issue.. Check each field. This is what I've found that's missing:

<input class="input is-primary @error('due_date')" type="date" placeholder=""

no @enderror here.

Mar
29
1 week ago
Activity icon

Awarded Best Reply on Call To A Member Function Threads() On Null

@siewlon6093

Is your route auth protected?

If it is not then it means that $request->user() is equal to null hence the error.

Activity icon

Replied to Call To A Member Function Threads() On Null

@siewlon6093

Is your route auth protected?

If it is not then it means that $request->user() is equal to null hence the error.

Mar
28
1 week ago
Activity icon

Awarded Best Reply on How Pass More Param To EditColumn Method

You should use use instead of with to pass a variable to a closure.

->editColumn('id', function ($storageSpace) use ($colorsCollection){
Mar
27
1 week ago
Activity icon

Awarded Best Reply on Clean Up Route's File

If it is just a view without a controller, you can use it like this:

Route::view('legals/cookie', 'legals.cookie');

https://laravel.com/docs/master/routing#view-routes

Activity icon

Replied to Clean Up Route's File

If it is just a view without a controller, you can use it like this:

Route::view('legals/cookie', 'legals.cookie');

https://laravel.com/docs/master/routing#view-routes

Activity icon

Replied to Problem With Unique Field Validation On Update In Controller

Here is the documentation: https://laravel.com/docs/7.x/validation#rule-unique

Take a look where it says : Forcing A Unique Rule To Ignore A Given ID.

And here is an example: https://stackoverflow.com/a/33553894/1457270

Activity icon

Replied to Select Raw Data With Date_format

@akmadhwa just add this one to your model:

public function getCreatedAtAttribute($value)
{
    return Carbon::parse($value)->format('Y-m-d H:i');
}

And then use it:

$user = User::first();
$user->created_at; // 2020-03-27 12:20
Activity icon

Awarded Best Reply on Socialite: Redirect Based On Role After Logged In

@james_bhatta seems like you have a route named for the role, so wouldn't this be enough?

public function authenticated(Request $request, User $user)
{
    $role = $user->role;

    return redirect()->route($role);
}

And do the same one line in the controller. I don't see a route for a customer but. I guess you should have one.

Activity icon

Replied to Select Raw Data With Date_format

@akmadhwa is your table called customer or customers?

Why do you need to specify it?

Just this does not work:

 $query = $this->model::selectRaw('DATE_FORMAT(created_at, "%Y-%m-%d %H:%i"));

What is your model instance here?

Activity icon

Replied to Laravel + Vue Scripts Won't Work Unless Page Is Refreshed

Unfortunately I don't know how to help you based on your message that it is not working.

Check the documentation: https://laravel.com/docs/master/mix#browsersync-reloading

Activity icon

Replied to Laravel + Vue Scripts Won't Work Unless Page Is Refreshed

@jaycarter watch just watches for changes in the files and recompiles them, but in order to let the browser know that you've changed something you need to swap those. So that's what hot reload does. You should read the blog post.

You should have a line like this in your package.json in the scripts:

"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",

try running npm run hot instead.

Mar
26
1 week ago
Activity icon

Awarded Best Reply on Checkbox Insert

@heimdall what type of field is your category_id? If it is an integer, you might need to loop through the array and persist a row for each of the categories:

foreach(request("categorybox") as $category_id)
{
    $category_dish = new category_dish();
    $category_dish->category_id = $category_id;
    $category_dish->dish_id = $Dishs->id;
    $category_dish->save();
}

And I would guess that you are validating that at least one checkbox is selected, otherwise nothing will be saved here.

Activity icon

Replied to Checkbox Insert

@heimdall what type of field is your category_id? If it is an integer, you might need to loop through the array and persist a row for each of the categories:

foreach(request("categorybox") as $category_id)
{
    $category_dish = new category_dish();
    $category_dish->category_id = $category_id;
    $category_dish->dish_id = $Dishs->id;
    $category_dish->save();
}

And I would guess that you are validating that at least one checkbox is selected, otherwise nothing will be saved here.

Activity icon

Replied to SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'name' Cannot Be Null

@dostogir I would guess that you have a name for the user, and you are missing it here to add, so add:

$user->name = 'Some name';

somewhere before you do $user->save();.