Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 16:34
    danilopolani commented #3271
  • 10:51
    pxpm closed #82
  • 10:51
    pxpm commented #82
  • 10:50
    welcome[bot] commented #84
  • 10:50
    pxpm opened #84
  • 10:47

    tabacitu on configurable-ini-settings-for-backups

    Apply fixes from StyleCI (compare)

  • 10:47

    pxpm on configurable-ini-settings-for-backups

    allow ini settings override to … (compare)

  • Oct 24 12:36
    priyankmaniar commented #257
  • Oct 24 04:07
    scrutinizer-notifier commented #3280
  • Oct 24 04:07
    scrutinizer-notifier commented #3280
  • Oct 24 03:40
    mahasadhu commented #3255
  • Oct 24 03:39
    scrutinizer-notifier commented #3280
  • Oct 24 03:39
    mahasadhu opened #3280
  • Oct 23 16:03
    welcome[bot] commented #3279
  • Oct 23 16:03
    gregraab assigned #3279
  • Oct 23 16:03
    gregraab labeled #3279
  • Oct 23 16:03
    gregraab opened #3279
  • Oct 23 13:16
    scrutinizer-notifier commented #3278
  • Oct 23 13:16
    scrutinizer-notifier commented #3278
  • Oct 23 12:54
    promatik edited #3277
Pedro Martins
@pxpm
this is not merged but you can see the code.
Guillermo Baron
@guillorrr
@pxpm obrigado!
Arkadiusz Chmura
@ClouddJR
Hi, if I understand correctly, the license code that I purchase is verified every time someone enters a backpack panel on my website. What kind of warranty do I have that the server that checks the validity of the license will not go down one day?
Wesley Smith
@DoDSoftware
@ClouddJR License codes are verified using an obfuscated internal mechanism, no remote servers involved.
Priyank Maniar
@priyankonweb_twitter
@DelightedD0D Thanks Wesley for your response :)
Marcus
@marcus-at-localhost
Hi, can I have an autocomplete field in a table field? or turn one/two of the textfields into an autocomplete?
Marcus
@marcus-at-localhost

The docs say about Custom Queries v4.1:

$this->crud->orderBy();
// please note it's generally a good idea to use crud->orderBy() inside "if (!$this->request->has('order')) {}"; that way, your custom order is applied ONLY IF the user hasn't forced another order (by clicking a column heading)

But $this->request->has('order') throws an exeption

ErrorException
Undefined property: App\Http\Controllers\Admin\GasketCrudController::$request

Is that advice maybe outdated?

Arkadiusz Chmura
@ClouddJR
@DelightedD0D Thanks for quick answer ;)
Another question, will Backpack work with Laravel 8.0?
Pedro Martins
@pxpm
@marcus-at-localhost you should use $this->crud->getRequest() or the global helper request()
indeed, docs need to be updated, i will try to don't forget to update them tomorrow
@ClouddJR backpack already supports L8 !
thanks :)
acewebsa
@acewebsa
Hey @anasred - I managed to do this in a couple projects.
in your controller in setup function use $this->crud->setShowView( 'contacts.show_contact' );
Then in your view file do a foreach in a table eg
<?php foreach ($entry->audits as $audit):?>
<?=$audit->id?>
<?php endforeach;?>
acewebsa
@acewebsa

hey guys. Just wondering if anyone knows how to get the file type from an upload file in backpack, and also file size.

If I use pathinfo it returns extension of tmp, which doesn't help.

public function setFileNameAttribute( $value ) {
        $attribute_name = "file_name";
        $disk           = "public";
        $destination_path = "files/" . $this->attributes['project_id'];
        $path = pathinfo( $value );
        $this->uploadFileToDisk( $value, $attribute_name, $disk, $destination_path );
        $this->attributes['file_type'] = $path['extension']; // returns tmp
    }
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.