-
Notifications
You must be signed in to change notification settings - Fork 321
Questions regarding installation and setup #15
Comments
Hi @gerardnll, using the service provider is not needed. It was added in an early version of the package and was forgotten since. Thanks for your notice, I will remove it in the next release.
Did you follow the installation instructions? Maybe you haven't done the step 4. Also make sure
This is not a very good design for your tables. Save
You have to add the presenters to your translation class. |
ok i've moved the slug column.
In the Post model i do not have to put a hasMany('PostTranslation') ? i supose this is done by the bundle. What i'm not sure if it's good coded is this ($post):
Thanks |
// PostTranslation.php
public function getBySlug($slug)
{
return $this->where('slug', '=', $slug)->first();
}
// controller
$this->translations = new PostTranslation;
$translation = $this->translations->getBySlug($slug);
if ( ! $translation)
{
return App::abort(404);
}
$post = $translation->post();
// ... I haven't tested the code above, but you get the idea. I am closing the issue since the problem is not related to the package. |
First of all, thanks for this bundle, which looks great.
After running composer update. do i need to set up the provider in app.php? should i put this 'Dimsav\Translatable\TranslatableServiceProvider'?
Second, if that's not necessary maybe the error (500) it's coming from another place. The 'php artisan serve' doesn't give me an error. But trying
in the controller makes laravel crash. it looks like it doesn't find the translated attributed.
I'm also using presenters so i have something like this, i don't know if this is the proper way of getting the translated and preformated properties:
on the post translation i have this:
This is my migration file:
Is the presenter going to take the translated attributes on the view? how should i do this?
Also, what about if i want to use a slug for a post, so every language has it's own slug? how can i access the post by the translation? Currently i have the translated slugs on the Post table but i don't know if that's the best way.
The text was updated successfully, but these errors were encountered: