cviebrock
Repos
96
Followers
352
Following
1

Easy creation of slugs for your Eloquent models in Laravel

3526
431

A Sequel Pro / Sequel Ace bundle to generate Laravel migration files from existing tables.

929
52

An easy way to use the official Elastic Search client in your Laravel applications.

832
166

Easily add the ability to tag your Eloquent models in Laravel.

441
70

My custom zsh theme

0
0

Events

opened issue
How does one submit to the WOF?

Thanks for making this, btw! My submission: https://www.strava.com/activities/7891785612

Created at 1 hour ago
Scoping new model?

Closing due to no response. Feel free to re-open or comment if you are still having issues.

Created at 1 month ago
Scoping new model?
 public function author(): BelongsTo
    {
        return $this->belongsTo(Author::class);
    }


public function scopeWithUniqueSlugConstraints(Builder $query, Model $model, $attribute, $config, $slug): Builder
    {
        $author = $model->author; // Author is null!

        return $query->where('author_id', $author->getKey());
    }

I'm using scopeWithUniqueSlugConstraints to scope a model by an ID in the model, which I can see how will work when editing a model because the author will exist, but when creating a new model I'm finding $author is null so I can't scope it?

Any advice appreciated?

Created at 1 month ago
Assign sprint points to a task via API?

I just tried hacking something in by changing the above to:

endpoint: `../../tasks/v1/${this.route}/${taskId}/pointsEstimate`,

I'm now hitting the right endpoint (i.e. what matches when I use the Clickup web interface). But I get an error:

{ err: 'Auth header missing', ECODE: 'JWT_008' }

So ... I'm guessing v1 of the API uses a different auth method/key than v2?

Created at 1 month ago

fix params

Created at 1 month ago
create branch
cviebrock create branch pointEstimates
Created at 1 month ago
Created at 1 month ago
Assign sprint points to a task via API?

The response returns a points: 8 as part of the task structure, but setting that on a createTask request doesn't work -- I just get null in the new task.

I viewed the network request as I updated an existing story's points, and see that it makes a request to:

PUT https://app.clickup.com/tasks/v1/task/abcd1234/pointsEstimate

{ points: 8 }

so I tried updating src/routes/Tasks.js by adding:


	/**
	 * Update the sprint points for a task
	 *
	 * @param {String} taskId The task id
	 * @param {Number} points The sprint points estimate
	 */
	async updatePoints(taskId, points) {
		return this._request.put({
			endpoint: `${this.route}/${taskId}/pointsEstimate`,
			params: {points},
		});
	}

However, using that function returns the error Cannot PUT /api/v2/task/2t29utt/pointsEstimate ... so I'm guessing it's a v1 API thing only, and not v2. I can't immediately see how to force a request to the v1 URL. Is that possible?

Created at 1 month ago
Sluggable

Provide more details if you have an issue. 😉

Created at 1 month ago
Sluggable
Created at 1 month ago
cviebrock create tag 2.0.2
Created at 1 month ago

update contact methods

Created at 1 month ago
cviebrock create tag 9.0.0
Created at 1 month ago

Laravel 9.0 support

Created at 1 month ago
Assign sprint points to a task via API?

I should clarify, I'm using the Sprint Points ClickApp for this. I have it enabled for the Space in which the List I am trying to create a task in exists. :)

Created at 1 month ago
Assign sprint points to a task via API?

I'm writing a script to migrate some stories from Pivotal Tracker over to Clickup, and would like to include the sprint points for each new Task I create in CU.

I've tried adding points: 5 and/or sprint_points: 5 to the data I pass to lists.createTask(id,data), but neither of those work.

Is this possible at all?

Created at 1 month ago
Laravel 9

If you made a PR for this, I'd gladly accept it. I don't use the package personally anymore, so I'm not sure what all is involved. I suspect it's just bumping some versions.

Created at 1 month ago
Conditionally force new slug

Hi,

Thanks again for this awesome package, I use it quite a lot.

Just one question, let's say we have a model that is saved with some kind of auto generated title like "Auto Draft" which then has a slug like "auto-draft", "auto-draft-2" et cetera as slug and the corresponding status which is always "auto-draft".

I was trying to find a solution by hooking into Eloquent Events to force an auto creation of the Slug once it starts with "auto-draft", but had no success.

I know there is:

SlugService::createSlug($post, 'slug', $value);

That I could for instance hook into the eloquent updating event but I was wondering if there might be a better solution?

Thank You

Created at 2 months ago
Conditionally force new slug

Ah, I think I get it. You would probably best handle this with the events:

Post::registerModelEvent('slugging', static function($post) {
    if ($post->status === 'auto-draft') {
        // the model won't be slugged
        return false;
    }
});

When the Post is finally saved, then the slug should get auto-generated. This would require that the slug field in your table be nullable, which might not be ideal in some scenarios.

You could also (thinking out loud here ... untested), do something like give it a random slug for when you are auto-saving in auto-draft mode. Then, when you do a "real" save, clear out the slug field just before saving. A few more steps though.

Your solution seems pretty good too. Instead of making the user enter a slug manually, you could use the SlugService::createSlug method and an AJAX call to suggest a slug for them once they've filled in the title field.

I'll close this story now, as I think you're probably good to go. Again, sorry for the very slow response.

Created at 2 months ago
Upgrade guzzlehttp/psr7

Can the guzzlehttp/psr7 package be upgraded to v2? I have conflicts with other packages

Created at 2 months ago
Upgrade guzzlehttp/psr7

@brunogaspar done in 9.0.2. Thanks for the suggestion ... I should've thought of that myself!

Created at 2 months ago
cviebrock create tag 9.0.2
Created at 2 months ago

Allow 1.7 of PSR7 still

Created at 2 months ago
Move from 4.2.2 to 8.x version

Hello!

Thanks for the package!

Is there any link with info about migration from 4.2.2 to 8.x ?

Have not found any information about breaking changes between versions.

Or I can do composer update without any risk of class api-s to be broken?

Created at 2 months ago
Move from 4.2.2 to 8.x version

Slow response ... sorry.

I don't know offhand of what differences there were between 4.2.2 and 8.x (or 9.x). There is the Changelog, where I try to list all the changes between various versions (and note if anything is a breaking change).

And there is, of course, git history. 😉

Looks to me like the only things that might be issues are that 9.x:

  • only supports Laravel 7, 8 and 9, and PHP 7.3–8.1
  • uses guzzlehttp/psr7 version ^2.0 (if you use it elsewhere in your project)
  • uses elasticsearch/elasticsearch version ^7.11

I don't think there are any breaking changes to the format of the configuration files, so you are probably safe to update.

Created at 2 months ago
Upgrade guzzlehttp/psr7

Version 9.0.1 of the package has this upgrade. Let me know if it works for you.

Created at 2 months ago
cviebrock create tag 9.0.1
Created at 2 months ago