I was tinkering with making a custom component for product images. This should process some arguments. If I look at the file /app/View/Components/Alert.php I get the feeling that this is something I could use as a boilerplate.
From what I understand you can call it and pass 2 arguments, $type and message, then it grabs the view from components.alert and renders it.
The thing is that I don’t know how to call this Alert component and pass arguments from, for example, /resources/views./page.blade.php.
It’s always like this. You’re stuck for over a day, post a question and find the answer… <x-alert />
But then I copy the Alert.php files and rename the class to ProductImage And it does not render with <x-productimage /> I did a composer dump-autoload but no go.
@alwaysblank. Thanks Ben, that gave all the missing info I needed.
One thing though. Even though I got it working a Sage 10 project folder is not able to call php artisan make:component Alert It has no artisan.
Acorn has wp acorn make:component myName It prints Component created successfully. But there is no trace of this newly created component. Not in the app/ and the resources/views/ folder. Not even id I search project wide for this name in camelCasing or kebab-casing. So where would it live.
If I re-run the command it says it already exists. Plus is there documentation on Acorn? It might give me hints on how to work with components. But I don’t see documentation on it.
Lately. I managed to create it manually by cloning the /app/View/Components/Alert.php Rename the file, class and view render in the return. Then create a custom view component in the /resources/views/components
I did the above on a Sage 10 site I’m working on, and got the above result.
If you’re trying to find files that have been created by an automated process, a good way to do that is to run git status: So long as you’ve been keeping up with your commits, it will clearly show the files that have just been added.
Son of a gun… I stand corrected. You are right, I’m sorry. I had two terminals open one for the parent theme and one for the child theme. Looks like I was working in the other terminal than expected. I found the files, yes. Thanks Ben, this makes it all a lot easier
Problem 1
- Root composer.json requires roots/acorn ^1.1 → satisfiable by roots/acorn[v1.1.0].
- roots/acorn v1.1.0 requires illuminate/cache ^7.0 → found illuminate/cache[v7.0.0, …, 7.x-dev] but the package is fixed to v8.27.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Tim, do you want to collaborate on a system together perhaps? We can share ideas and such, I’m also using TailwindCSS. Perhaps via discord if you want?
I came to the conclusion acorn has troubles with multiple Sage themes in the wp themes folder. This is the main reason I didn’t got it to work. It saw two sage themes and asked me about 8 times which theme I wanted to install the component in. Selecting each time the right theme still did not help. It installed one of two files in the one theme and one file in the other theme. Another time it just kept installing it in the wrong theme. This is why it did not show up in my git status.
I’m sorry @AurelianSpodarec I don’t think I’ll be the right person for a collab I’m not very experienced. Plus for me the components in sage 10 just worked (after the frustration mentioned above). If you don’t get acorn to work you can still manually place the files in those directories without acorn. Take a look at the preinstalled Alert components and copy/paste it to make your own.