Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 30 20:02
    bahman2216 edited #3292
  • Oct 30 20:02
    bahman2216 labeled #3292
  • Oct 30 20:02
    bahman2216 opened #3292
  • Oct 30 16:22
    scrutinizer-notifier commented #2253
  • Oct 30 16:22
    scrutinizer-notifier commented #2253
  • Oct 30 16:19
    promatik commented #3267
  • Oct 30 16:04
    scrutinizer-notifier commented #2253
  • Oct 30 16:04
    scrutinizer-notifier commented #2253
  • Oct 30 16:04

    pxpm on update-date-range-filter

    fix key string Co-authored-by:… (compare)

  • Oct 30 16:04
    pxpm synchronize #2253
  • Oct 30 15:54
    pxpm commented #3267
  • Oct 30 13:10
    promatik commented #3267
  • Oct 30 12:42
    AndresLealColon commented #3290
  • Oct 30 12:23
    promatik commented #2253
  • Oct 30 10:55
    pkuzz commented #3291
  • Oct 30 10:38
    tabacitu commented #191
  • Oct 30 10:37
    pxpm commented #3291
  • Oct 30 10:35
    pxpm assigned #3291
  • Oct 30 10:28
    pxpm assigned #3290
  • Oct 30 10:28
    pxpm unlabeled #3290
Wesley Smith
@DoDSoftware
@acewebsa It seems odd to have the upload functionality inside a model's mutator method. That said, the following code is untested but should do what you need:
$file = request()->file($attribute_name);
$mimeType = $file->getMimeType(); // trusted value uses finfo(), better to use this
$extension = $file->getClientOriginalExtension() // extracted from the original file name that was uploaded, ie, not trust worthy but it is an option
$size = $file->getSize();
paperscissors
@paperscissors
Hey folks, I'm using v4.1 over here --- I have a strange thing going on where I try to use the relationship field type on an n-n relation with ajax searching enabled. When I try to search for a relation I get a 405 Method Not Allowed when I look at the console. Is there some step I am missing in regards to creating a route, etc here that's not listed in the docs? The endpoint it's trying to reach is /admin/{entity}/fetch/{relations}.
jorgepires
@jorgepires
Hi guys, I need some help on handling select options (set/get) due to angular, I have zero knowledge on angular, is there anyone available to sell some of your time to help me overcome this issue? It is related to have a select on change event modifying another select
Wesley Smith
@DoDSoftware
@paperscissors Does your crud controller have a use statement like use \Backpack\CRUD\app\Http\Controllers\Operations\FetchOperation;?
@jorgepires We'd be happy to help, the best format might be to post your question on stackoverflow.com where you can show your code and explain the issue, tag that question with the "backpack-for-laravel" tag, then drop a link to that question here.
Guillermo Baron
@guillorrr

Hi! I have a custom pivot table (evaluation_id, thread_id, question_id), and I'm using the select_multiple field in create to query the relationship

class Evaluation extends Model

public function questions()
{
        return $this->belongsToMany(Question::class, 'evaluation_question')->withPivot('thread_id');
}

This is my crud field

CRUD::addField([       // Select_Multiple = n-n relationship
    'label'     => 'Select_Multiple',
    'type'      => 'custom_select',
    'name'      => 'questions',
    'entity'    => 'questions',
    'attribute' => 'title',
    'model'     => Question::class,
    'pivot'     => true,
    'pivotFields' => [
        'thread_id' => 'thread_id',
    ],
    'tab'       => __('base.questions'),
    // 'wrapperAttributes' => ['class' => 'form-group col-md-12'],
]);

How to set a default value in the pivot field like thread_id = 2?

Wesley Smith
@DoDSoftware
@guillorrr there doesn't appear to be any functionality built in that would allow us to set defaults for a pivotFields column. An alternative might be to set a default value for that column on the database table itself. Would that work for your use case?
jorgepires
@jorgepires
Hi @DelightedD0D , thank you for your input, I have added my question in stackoverflow https://stackoverflow.com/questions/63973518/laravel-backpack-javascript-dynamic-change-of-select-option
acewebsa
@acewebsa
Thank you so much @DelightedD0D - That worked fantastic. Thanks
Wesley Smith
@DoDSoftware
@acewebsa Awesome, glad to hear it! Happy coding :)
Sami Greenbury
@Patabugen
image.png
image.png
The datetime_picker field suggests adding this setDateTimeAttribute to my model - but it doesn't say what the \Date::parse class is. What should I import for that?
paperscissors
@paperscissors
@DelightedD0D it doesn't --- I just tried to add it in and I still get this 405 error.
I see the bits about fetchTag however, I will try those.
paperscissors
@paperscissors
No luck even with an explicit fetchTag definition. Here's the error: The POST method is not supported for this route. Supported methods: GET, HEAD.
Here's what I added to the controller per the docs.
<?php
use \Backpack\CRUD\app\Http\Controllers\Operations\FetchOperation;

    protected function fetchTag()
    {
        return $this->fetch([
            'model' => \App\Models\Creator::class, // required
            'searchable_attributes' => ['name'],
            'paginate' => 10, // items to show per page
            'query' => function($model) {
                return $model->active();
            } // to filter the results that are returned
        ]);
    }
Wesley Smith
@DoDSoftware
@Patabugen that's referring to the laravel facade, you shouldn't have to import it, but you can for IDE typehinting purposes and such via use Illuminate\Support\Facades\Date;
1 reply
Wesley Smith
@DoDSoftware
@paperscissors what is the actual name of the relationship you're attempting to fetch? ie, what is the name of the method on the main model that returns the relationship? if it is creator, please try updating protected function fetchTag() to protected function fetchCreator() and ensure that the 'name' in your field configuration is also set to creator
Wesley Smith
@DoDSoftware
@paperscissors also worth noting, you probably dont actually want the 'query' option shown in the example call to fetch, unless your Creator model actually has a scopeActive method on it. That's just an example showing how you can modify the query it will run to apply some conditions.
Timmy
@PouakaiNz
Hey, Can I on page load default order by a col that has custom orderLogic on it with $this->crud->orderBy('') ?
Timmy
@PouakaiNz
Sorted it with $this->crud->customOrderBy
ShekharKokate
@ShekharKokate
Hi everyone,
I want to open media gallery in backpack when click on browse.
I have added file manager and the images are stored in amazon s3.
Please help me, how can I open the media gallery?
Wesley Smith
@DoDSoftware
Hi @ShekharKokate Im not sure I understand the issue. Perhaps you could open a question on stackoverflow.com, post your question and code, and tag it with backpack-for-laravel, then post the link here? That format would allow us to help you a lot more effectively.
Antony Peiris
@antony.peiris_gitlab
Hi, I'm not sure if this is the right place to ask this question... apologies in advance if that's the case. I am planning on buying the Unlimited License but before I do so, I wanted to get some extended training on Backpack. I am familiar with the basics but I want know if there are resources available for learning advanced customization best practices (apart from the docs I mean). What's the recommended solution for this, is there a course or something?
Wesley Smith
@DoDSoftware
@antony.peiris_gitlab There is a "Getting started" video course here https://backpackforlaravel.com/docs/4.1/getting-started-videos but there are no advanced courses that I'm aware of. Are there any specific topics or features you'd like to see a video tutorial for? Perhaps we (the community) could make that happen :)
paperscissors
@paperscissors
@DelightedD0D Yes, that is exactly what the problem was. Going to create a PR on the docs to clarify this a bit. Thank you!
Wesley Smith
@DoDSoftware
@paperscissors Awesome, glad to hear it !
Alex Sklavenitis
@automat64
Hello all! Has anyone used Astronomic/laravel-translatable with backpack? https://github.com/Astrotomic/laravel-translatable
ShekharKokate
@ShekharKokate
Hi Everyone,
https://stackoverflow.com/questions/64044172/backpack-media-library
Please check the link and help me to resolve the query
ShekharKokate
@ShekharKokate
Hi Everyone,
I have used field type as browse. But, when I select image and trying to save it in amazon s3, it is not saving. Please help me to solve this issue.
Wesley Smith
@DoDSoftware

@automat64 I haven't used it but it looks interesting. Offhand, I'd think you'd probably need to
1) extend vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Read.php and override the entry getter methods (getEntry, getEntryWithoutFakes, getEntries, etc..)
2) override any of the views that pull related models directly in the views (select_multiple.blade.php, etc..)
3) work around potential issues with related models and "fake" columns that are derrived from columns that store JSON

Seems doable with some work though :)

4 replies
Wesley Smith
@DoDSoftware
@ShekharKokate i've replied to your SO question, please see the comments/question there when you have a chance :)
ShekharKokate
@ShekharKokate
Hi @DelightedD0D,
Thanks for your reply.
I have added comments on SO. Please check it once.
Gastón Berruet 🇦🇷
@gastonberruet_twitter
How do I make a Select 2 Multiple Groups?
I tried the option of select_grouped and select2_multiple but I need it to be a select2_multiple_grouped
Hi, i from Argentina
Wesley Smith
@DoDSoftware
@gastonberruet_twitter It doesnt look like there's a field for that but you could create a custom field combining the logic from select2_grouped.blade.php and select2_multiple.blade.php at a glance it looks like you'd only need to pull in the logic that creates the options
Marcus
@marcus-at-localhost
I installed Statamic 3 into an existing Backpack project. After messing with Users/Permission, I was able to access statamic and create a first page, but all I ge its a backpack 404 page on the frontend. Statamic claims its routing works out of the box: https://statamic.dev/routing - any hint, how to debug this?
Marcus
@marcus-at-localhost
Ok, this wasn't a backpack issue, but a statamic issue with missing views and what not. Has anybody experience running backpack& statamic side by side? Any pitfalls to be aware of?
Wesley Smith
@DoDSoftware
@marcus-at-localhost Hmm, I hadn't heard of Statamic. I took a read through their site and documentation. It looks pretty cool in its own right. For the applications I build, I don't think mixing Statamic into my sites with Backpack would be beneficial to my workflow. The packages/platforms seem to have somewhat opposing philosophies. Perhaps though your projects could benefit from the use of both. After you've worked with them a bit together I'd love to hear back from you regarding your experience and they ways you've used parts of each together to build something awesome. Happy coding!
Marcus
@marcus-at-localhost
The way I aim to use both is, to have statamic take care of building the typical website stuff and backpack to deal with data in legacy databases and tabular data in general, that will be rendered in statamic or in a custom route. Not sure how this all will work out :) - but I will report. Thanks!
Daniel Ng`andu
@DanielNgandu
Hey guys, i am getting this error 'BadMethodCallException
Call to undefined method App\Models\User::identifiableAttribute()', how do i fix it on Laravel 7 + Backpack v4 ?
Pedro Martins
@pxpm
Hello @DanielNgandu , make sure your model is using CrudTrait. Best
Daniel Ng`andu
@DanielNgandu

Hello @DanielNgandu , make sure your model is using CrudTrait. Best

Thanks, I got it working.

Antony Peiris
@antony.peiris_gitlab
@DelightedD0D Thanks for your response! :) I'm well beyond those getting-started vids on the site, and am familiar with the documentation as well. I reference it all the time when I am adding features, managing relationships and stuff. If the community can add more advanced stuff, that would be really awesome. As for specific topics, I would like to see more advanced customization involving AJAX mixed in with multiple relationships, filters etc... For example, if I wanted to build an interactive UI that interacts with multiple Models and is relationship aware, loads selections based on previous form selections, etc... does that make sense?
Cesc
@francescjr_twitter
Hello everyone, I have a problem with this, the error is: "Class 'App\User' not found (View: C\Users...login.blade.php), i don't know what i have to do, i followed all the instructions. I'm desasperated. If someone can help me, i will appreciate it.
Wesley Smith
@DoDSoftware
@francescjr_twitter If you're like most people using laravel, you've probably put your user model in App\Models\User, or, if you're using laravel 8, I believe it puts it there by default now. If either is true, please update login.blade.php to look forr App\Models\User instead of App\User
@antony.peiris_gitlab Gotcha, yeah that makes sense Id like to see those too. Next time im working with something along those lines Ill certainly look at trying to make a tutorial out of it :)
Pedro Martins
@pxpm
Just an heads up, to properly configure your user model is inside the config file config/backpack/base.php and look for: user_model_fqn