docs's People
Forkers
ikkebra markcollister patabugen minhaltplus jackfruh dabenzel marcbrillault dividy edgareler mattsches aand18 webdevbusinessassist redf150flames aleszatloukal laraviet imansugirman aleksandr1705 jianostack librasulus pxpm jsvini dendevs robzwolf okadsistemas slaycaster vreeken rbenosa jamesking56 zachweix mustberain malesellier-kryzalid martijnvadrichem mutahhar net-worm oddvalue fraserr onkbear sicouk imokhles yarob50 pouakainz ibpavlov gigo6000 sewahub obiefy themagnifico genesiscz tsnobre90 bertvthul flartet maig81 jnoordsij badawys cplewnia robzlabz tibbsa tomsb chuisauce sniperwolf dorianlsl yabbou alan-smith-be itmgmt-codecorp paperscissors polfo mahasadhu mthach s-nunez alshahen ivanorischenko zobay ilyasslh githubferran shiroamada shamarkellman mohammed-elmasry rosarioej87 hemant17 mikeybelike vernard tm-blg umeshkadam kamieljv collenz murtazadci parthik-quebix taras-budzyn ablunier hluaces kiurd-gentleman webboty tomhelmer vandolphreyes tommica ferrysoto willgun drusac egyweb-mohamed realtebo o15a3d4l11s2docs's Issues
[4.1][WIKI] How to use image mutator inside Repeatable field
So Repeatable it's an amazing field but i had issue with image field inside it of how to save image path or even override the mutator function of it so after a simple research i was able to fix it like that.
[ // repeatable
'name' => 'images',
'label' => 'Images',
'type' => 'repeatable',
'fields' => [
[
'name' => 'image',
'type' => 'image',
'label' => 'Image'
],
[
'label' => 'Big Image',
'name' => 'is_big',
'type' => 'checkbox',
],
],
]
public function setImagesAttribute($value)
{
$images = json_decode($value, true);
if (count($images)) {
foreach ($images as &$jsonInfo) {
$image = $jsonInfo['image'];
if (Str::startsWith($image, 'data:image')) {
$newImage = $this->setImageMutator($image);
$jsonInfo['image'] = $newImage;
}
}
$this->attributes['images'] = json_encode($images);
}
}
Image Setter same as documentation with some comments to serve my need
public function setImageMutator($value) {
// or use your own disk, defined in config/filesystems.php
$disk = 'cloud_disk';
// destination path relative to the disk above
$destination_path = "cloud/media/uploads";
// if the image was erased
// if ($value==null) {
// // delete the image from disk
// \Storage::disk($disk)->delete($this->{$attribute_name});
//
// // set null in the database column
// $this->attributes[$attribute_name] = null;
// }
// if a base64 was sent, store it in the db
if (Str::startsWith($value, 'data:image'))
{
// 0. Make the image
$image = \Intervention\Image\Facades\Image::make($value)->encode('jpg', 90);
// 1. Generate a filename.
$filename = md5($value.time()).'.jpg';
// 2. Store the image on disk.
\Storage::disk($disk)->put($destination_path.'/'.$filename, $image->stream());
// 3. Delete the previous image, if there was one.
// \Storage::disk($disk)->delete($this->{$attribute_name});
// 4. Save the public path to the database
// but first, remove "public/" from the path, since we're pointing to it
// from the root folder; that way, what gets saved in the db
// is the public URL (everything that comes after the domain name)
$public_destination_path = Str::replaceFirst('public/', '', $destination_path);
return $public_destination_path.'/'.$filename;
}
}
Images saved in database like that
And also uploaded and saved to my disk correctly
Hope it helps someone and hope it make sense, any suggests for improvements.
backpack:crud is not a command
I have installed Backpack 4.0.23 and run php artisan backpack:install
. However, I am having a basic problem following the tutorial. I have "4.0" selected as my version of Backpack when browsing the documentation. I therefore assume that there is a version of Backpack 4.0.x where php artisan backpack:crud tag
is a valid command, where x < 23. However, in Backpack 4.0.23, php artisan backpack:crud tag
fails with the following message: Command "backpack:crud" is not defined.
If the command was removed between 3.6 and 4.0.x, it needs to be listed in the Release Notes. Additionally, you need to expand the tutorial to cover the creation of the request file.
[Docs] Example on different polymorphic relationships
Is there any example on how to add different polymorphic relationships? I couldn't find any useful example.
In upgrade Guide to 4.0 6.1 should come before 6.0
When upgradingt from 3.6 to 4.0 it's best to do step 6.1 before 6 in the upgrade guide.
This is beacuse 6.1 removes some old parent:: calls which step 6 says you need to change - but you don't actually need to change them (beacuse 6.1 says to remove them).
I can push a pull-request, but I'm not sure about changing the numbering. If you're OK with me making the removal of public function store(StoreRequest $request)
etc step 6.0 and the removal of return parent::show();
etc step 6.1 then I'll make a pull request.
Cannot create tag, a column not found
I follow the tutorial in the Getting Start. 1. Basics. And until CRUDs, I run the command mentioned.
Then I run php artisan migrate
.
Afterwards, I just copy and paste the code in controller, here is my final TagCrudController.php
file:
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\TagRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class TagCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class TagCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
public function setup()
{
$this->crud->setModel('App\Models\Tag');
$this->crud->setRoute(config('backpack.base.route_prefix') . '/tag');
$this->crud->setEntityNameStrings('tag', 'tags');
}
protected function setupListOperation()
{
$this->crud->setColumns(['name', 'slug']);
// TODO: remove setFromDb() and manually define Columns, maybe Filters
$this->crud->setFromDb();
}
protected function setupCreateOperation()
{
$this->crud->setValidation(TagRequest::class);
$this->crud->addField([
'name' => 'name',
'type' => 'text',
'label' => "Tag name"
]);
$this->crud->addField([
'name' => 'slug',
'type' => 'text',
'label' => "URL Segment (slug)"
]);
// TODO: remove setFromDb() and manually define Fields
$this->crud->setFromDb();
}
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}
After logging in and try to add a new tag, an error prompted and said:
Illuminate\Database\QueryException
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'slug' in 'field list' (SQL: insert into `tags` (`name`, `slug`, `updated_at`, `created_at`) values (test, test, 2020-03-04 07:40:26, 2020-03-04 07:40:26))
Yes I know that the migrate file did not have slug column. However, can I assume that once I use the code in TagCrudController
, the column is there?
If not, it seems that your tutorial is not updated since I did not see any step on "Creating a slug column in controller".
So, can you please tell me how to solve it? Thank you.
import button via ajax in single page article
I would like search images in storage upload and
if article title is in name file 'title-article.jpg' for example associate image automatically.
All via Ajax.
It is possibile?
For Example:
Add field button "import images" in page article.
When click button, search in storage upload, and if files exist response it in view.
Single Date filter example in docs doesn't work with the '=' operator, but works without it.
instead of this:
...
function($value) { // if the filter is active, apply these constraints
// $this->crud->addClause('where', 'date', '=', $value);
});
use this instead:
...
function($value) { // if the filter is active, apply these constraints
// $this->crud->addClause('where', 'date', $value);
});
Page in docs is missing
[Bug] Incorrectly shown code
Custom views code snippet in CRUD api page seems to be broken
https://backpackforlaravel.com/docs/4.0/crud-api
I would create a PR, but is seems like a bug in the doc rather than in the doc file.
It looks perfectly fine
For some examples code formatting is not consistent
Also, in some places there are comments like these and they break "autoformat" like this:
I made some changes to make formatting consistent and moved some comments so that auto format on copy&paste knows how to correctly format the code (tested in PhpStorm)
Pull request: #66
How to use Spatie/Laravel-Media with Backpack
Add documentation on how to use upload fields with spatie/laravel-media:
- section in CRUD's How To
- field type
browse
- link to the HowTo section above - field type
browse_multiple
- link to the HowTo section above - field type
image
- link to the HowTo section above
remove setFromDb() and manually define Fields and Columns
This issue was generated by todo based on a TODO
comment in d246d8c when #16 was merged. cc @Laravel-Backpack.
[Example] How to create a Backpack add-on with multiple CRUDs
What about backpack/langfilemanager version for backpack/CRUD 4.0?
I did find any place about backpack/langfilemanager
version. When i update backpack/CRUD 3.6 to 4.0
. I got backpack/langfilemanager error. Previously i used
backpack/langfilemanager ^1.0`.
Can i remove "backpack/base": "^1.0.0"
from composer.json
?
Text Course in v12 should use Fluent Syntax
Same as our Video Course, same as our Generators. Both for consistency across our docs, AND because it's actually easier to use.
[Example] How to create a Backpack add-on for a CRUD with external dependencies
[4.0][Documentation Request] Buttons with modals to require further inputs
@ziming asked for this feature here: Laravel-Backpack/CRUD#1935 (comment)
Basically a way to more easily add buttons that ask for futher info, in the form of a CRUD field. We could code this as an example, or as a feature once we do exports in PHP instead of DataTables.
Stop asking me to login, or keep me logged in longer.
Figuratively speaking, "every time" I open a browser to review the documentation I'm assaulted with a fullscreen modal encouraging me to login. Which is annoying on the face of it. Worse is that when I do log in the session doesn't seem to stick around very long so when I come back later that day I'm asked to log in again. Makes the documentation very frustrating to pull up.
(Really loving Backpack so far and I'll grant this is a minor issue but it's just driving me 🥜)
CRUD Tutorial 4.0 incorrect import model
I was getting an error following the tutorial CRUD Tutorial 4.0 in a new project Model
Import for CrudTrait is incorrect Backpack\CRUD\CrudTrait;
Solution from Upgrade Guide
replace
Backpack\CRUD\CrudTrait
withBackpack\CRUD\app\Models\Traits\CrudTrait
404 link at the bottom of 3.4
At the bottom of Basics you've got a link
That’s all for today! If you want to learn more, go ahead and read the next lesson of this series.
Pointing to this page, which is 404'ing: https://backpackforlaravel.com/docs/3.4/getting-started-anatomy-of-a-crud
I'm assuming it's meant to proceed to https://backpackforlaravel.com/docs/3.4/getting-started-crud-operations
Just a heads up!
[Proposal] Flow chart on how a CRUD works
Similar to how CodeIgniter does it, we could create a simple diagram to explain how CRUDs work:
- route points to controller
- controller
- extends CrudController from the package
- uses traits from the package
- uses views from the package
- uses Model
- might use FormRequests
- model
- uses DBMS
What is the correct way to call store and update function?
I looked backpack upgrade guide 3.6 to 4.0 and it shows store and update
function have $request
parameter like image 1
But after that i checked crud-operation-create and crud-operation-update function in doc it shows store and update
function have not $request
parameter like image 2 and 3.
My question is which is the correct one?
Unclear How to Use Paid License Key
I scoured Google and the docs, and was unable to find where the license key goes. I ended up doing a search on the code base for the 'You're using unlicensed software' string to find the code responsible for the key check, and saw it was a config. Maybe we could make it easier for people to know where the code goes?
It's possible an instruction was sent in an email, but I'm on a team and didn't see the email that may have been sent out.
I was also unable to see instructions by logging into the dashboard; I was only able to find the key and no instruction on how to use it.
It's possible I'm blind but I'm not seeing docs on this 😅
Markdown parser
Hi,
Does anyone know which Markdown parser is being used for Docs website?
When I was creating pull request, I found a broken section here.
It is working on GitHub therefor, I am guessing caused by Markdown parser.
Thanks,
Upgrade Guide never says to re-run `php artisan backpack:install`
After upgradig from 3.8 I'm missing a couple of files - BackpackUser.php
and CheckIfAdmin.php
specifically.
Running :install seems to fix it by putting the missing files in place.
However the upgrade guide never mentions to re-run php artisan backpack:install
except if if using elFinder.
Should it mention it somewhere? (if so, where?).
[4.1] Update callback confusion
Referring to Laravel-Backpack/CRUD#235 (comment)
Can the documentation for the update 'callback' please be improved to reflect how to properly do this? (Of course please correct me if this is indeed NOT the right way to go about this)
ExampleCrudController.php
public function update()
{
$request = request();
$request->request->add(['new_field' => 'New value']);
$response = $this->traitUpdate($request);
return $response;
}
Using the code from the documentation $this->crud->request->request->add(...)
was always resulting in Cannot access protected property Backpack\CRUD\app\Library\CrudPanel\CrudPanel::$request
[4.1] Add hint to FetchOperation in documentation for InlineCreate operation / 'relationship' field type
Background
I implemented a relationship
field for a Category attribute within a Product's CRUD controller. I followed the InlineCreate Operation documentation.
I expected to be able to see existing category entities in the relationship and be able to search for existing category entities. Both things did not work. The category field just stayed empty.
The browser's developer console showed me error 404s for the fetch
-routes. For example, when opening the product's create/update view, the category field did not show any content, but the browser reported an error 404 for /admin/product/fetch/category
(and more 404s when I continued to type in the category field's search).
The solution
I stumbled upon the fact that I needed to implement the fetch operation (which enables ajax) in my CRUD controller as documented here.
The only hint is given by the code example on InlineCreate Operation documentation page:
// for 1-n relationships (ex: category) - inside ArticleCrudController
[
'type' => "relationship",
'name' => 'category', // the method on your model that defines the relationship
'ajax' => true,
'inline_create' => true, // assumes the URL will be "/admin/category/inline/create"
]
It shows the usage of 'ajax' => true
. I at first thought it was just a coincidence of this example and that I can use the InlineCreate operation without ajax as neither the requirements nor the how to use sections document the requirement to implement the fetch operation / ajax.
I suggest to improve the documentation of the InlineCreate operation.
remove setFromDb() and manually define Fields
[4.1][Upgrade guide] - Add reference to the use of 'appends' in case of using an accessor
Hi,
first of all thank you very much for all your efforts and your awesome product.
I have just upgraded Backpack from version 4.0 to 4.1.
The upgrade guide is very detailed, but i had a problem with an accessor column attribute.
After I investigated for a while I found out that i had to add the accessor attribute to the $appends
model's variable.
As reported in this Pedro's comment (Laravel-Backpack/CRUD#2732 (comment)) i would suggest to add some reference to the use of the following property:
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = ['snake_case_accessor'];
In my opinion the addition could be done in the Model section.
Since the use of the $appends
is not requested by default using a model accessor (but just if the accessor computed values are to be added to the array / JSON representations of the model),
it would be nice to have some reference also in the main guide.
Thanks
Luca
[Example] How to create a Backpack add-on with an entire CRUD
[Example] How to create a Backpack add-on for a custom button
[Proposal] Troubleshooting section
A place where we can:
- direct people to the right place if they get stuck (StackOverflow, Gitter, Reddit);
- treat each common user error in particular, and its solution (sort of a FAQ);
Backpack Docs on Dash?
How can we make Backpack's docs appear in Dash?
Easily create, share & use third-party field types
For Backpack developers to easily be able to share field types, column types, buttons, it would be great if people could install field types using composer require
. So we could:
- create a package skeleton for people to develop extra fields/columns/buttons
Provide a simple way to use those installed fields/columns/buttons.
This is already possible, but we should:
- make it easier, using a package skeleton
- write a tutorial on how to do it
- provide a place for people to post their packages (maybe with upvote/downvote system, or stars, so that it's not moderated and completely open to everyone)
Backpack Docs on DevDocs?
How can we make the Backpack docs appear on DevDocs?
- use explanation in github issue to write steps
This issue was generated by todo based on a TODO
comment in d246d8c when #16 was merged. cc @Laravel-Backpack.
Should be dark mode
When someone tries to read the document, it kinda feels hurt our eyes when reading all article in white background, so please make the dark mode for Simple & Calm UI
Better docs on how to create a Backpack addon, using the auto-wiring in the skeleton
So I've created this thing. This addon skeleton should allow backpackers to create add-ons a lot more easily, basically without even thinking about how packages are supposed to work, because if the files are in the correct place, they'll just be loaded by the AddonServiceProvider
we're built.
So basically the process would be:
- code in your own project
- use laravel-packager to create a new package, and use our skeleton as a template there;
- move the files into the package;
- create a Github repo and push the changes;
- put it up on Packagist;
- remove it from
packages
and install it intovendor
to make sure it works for others;
But... we should create a more detailed guide.
Crash Course in v12 should use Fluent Syntax
Same as our Video Course, same as our Generators. Both for consistency across our docs, AND because it's actually easier to use.
do whatever logic you need here
This issue was generated by todo based on a TODO
comment in d246d8c when #16 was merged. cc @Laravel-Backpack.
remove setFromDb() and manually define Columns, maybe Filters
remove setFromDb() and manually define Fields and Columns
This issue was generated by todo based on a TODO
comment in d246d8c when #16 was merged. cc @Laravel-Backpack.
[Example] How to create a Backpack add-on for a custom column
Views customizing documentation broken link
Hi,
The documentation to customize the blade views has a broken link.
In https://backpackforlaravel.com/docs/4.0/getting-started-basics the link to the "ridiculously easy." process to customize the views lead to a broken link: https://backpackforlaravel.com/docs/4.0/%7Bversion%7D#customize-views-for-each-crud-panel
Correct URL: https://backpackforlaravel.com/docs/4.0/crud-how-to#customize-views-for-each-crud-panel
[Example] How to create a Backpack add-on for a custom filter
backpack:add-custom-route and backpack:add-sidebar-content executes twice
Documentation Update
Bug report
In the following document we are advised to set custom views per crud as follows:
$this->crud->setCreateView('your-view');
https://backpackforlaravel.com/docs/4.1/crud-how-to#customize-views-for-each-crud-panel
What I did
Used the following:
$this->crud->setCreateView('my_create_view_name');
Folder location of view file:
resources/views/vendor/backpack/crud/my_create_view_name.blade.php
What I expected to happen
The custom view would be used for one particular crud create view
What happened
This gives a view not found error
What I've already tried to fix it
The solution is to use:
$this->crud->setCreateView('crud::my_create_view_name');
It would be useful if the documentation reflected this
Please document backpack:
Possible miscommunication in 4.1 Upgrade Guide
Here's what @azaricstefan had to say about it:
Wanted to share these 2 things with you.
Step 9 useful updates:
- I noticed that you didn’t take into account table revisions, I fixed that manually by just adding replace in the same migration that you created.
- I had BackpackUser before, now I deleted it as per guide but I get errors such as:
- Call to undefined relationship [roles] on model [App\Models\User].
Solution for this was to add this to User model:
use Spatie\Permission\Traits\HasRoles;
use HasRoles;
Maybe it will be useful to update the upgrade guide with these 2 points, if someone else is experiencing same issue as me.
Let's please investigate and see if we need to make changes to our guide or something.
Go through docs and rewrite so first-time Laravel users can learn Laravel & Backpack at the same time
The Problem
We seem to have more&more users who are not very accustomed to all the Laravel jargon, because it's their first/second/third Laravel project, so they haven't gone though most of the Laravel features.
Since we don't explain a lot of stuff we consider general-Laravel-knowledge, these people get stuck or wonder what this is and that is. Which must be very frustrating, leading them to think "our docs are bad".
The Solution
We should run another pass through our entire docs, reading it like it were our first/second/third Laravel project and we decided to use Backpack. That'll probably convince us we need to:
- provide links to the Laravel docs when we use Laravel jargon (ex: accessors/mutators/request/validation/etc)
- explain the MVC concept and the normal request lifecycle (route-middleware-controller-model-view) - a diagram would probably help a lot here
- what else...?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.