Comments (8)
Thx...now it works without json_encode
.
from laravel-eloquent-flag.
You've got an issue in your view file accordingly to the error message. Could you show it?
from laravel-eloquent-flag.
Blade file index.blade.php
:
@extends('layouts.manage')
@section('content')
<posts-index
:table-data="{{ $posts }}">
</posts-index>
@endsection
Vue component index.vue
:
<template>
<fragment>
<div class="level">
<div class="level-left">
<div class="level-item">
<h1 class="title">Администрирование постов</h1>
</div>
</div>
<div class="level-right">
<div class="level-item">
<a :href="route('manage.posts.create')" class="button is-link">
<b-icon
icon="plus">
</b-icon>
<span>Создать пост</span>
</a>
</div>
</div>
</div>
<div class="columns is-multiline">
<div class="column">
<b-table :data="data">
<template slot-scope="props">
<b-table-column field="title" label="Название">
{{ props.row.title }}
</b-table-column>
<b-table-column field="excerpt" label="Короткое">
{{ props.row.excerpt }}
</b-table-column>
<b-table-column field="status" label="Статус">
{{ props.row.status }}
</b-table-column>
<b-table-column label="Действия">
<!-- <a class="button is-outlined is-small m-r-5" :href="route('permissions.show', props.row.id)">Просмотр</a><a :href="route('permissions.edit', props.row.id)" class="button is-small is-outlined">Редактирование</a>-->
</b-table-column>
</template>
<template slot="empty">
<section class="section">
<div class="content has-text-grey has-text-centered">
<p>
<b-icon
pack="far"
icon="frown"
size="is-xxlarge">
</b-icon>
</p>
<p>Ничего нет</p>
</div>
</section>
</template>
</b-table>
</div>
</div>
</fragment>
</template>
<script>
export default {
props: ['tableData'],
data() {
return {
data: this.tableData
}
}
}
</script>
from laravel-eloquent-flag.
Your issue not related to this package. You cannot pass objects to Vue components this way:
:table-data="{{ $posts }}"
It awaits a string, but you giving an object to it. Have you tried this way?
:table-data="{{ json_encode($posts) }}"
Or Blade alternative:
:table-data="@json($posts)"
from laravel-eloquent-flag.
Ok, no error now, but I still can't see my posts... empty table with this line $posts = Post::onlyNotPublished();
. Why?
And why basic framework staff works fine without json_encode
?
from laravel-eloquent-flag.
Ah.... you've applied scope, but not performed an action:
Post::onlyNotPublished()->get();
from laravel-eloquent-flag.
Now I see that documentation isn't clear that it's just scopes. You could chain many scopes like:
Post::onlyNotPublished()->withoutNotVerified()->get();
And so on.
from laravel-eloquent-flag.
@Sogl thanks for pointing this out. I've updated documentation.
from laravel-eloquent-flag.
Related Issues (20)
- v3.0 release HOT 1
- Style change log HOT 1
- Set future date for timestamp flags HOT 1
- [CONCEPT] Casts flags HOT 1
- can this be used for "user-to-many" blocked scenario? HOT 3
- Fire events HOT 19
- Remove force auto-applying global scopes HOT 9
- Add tests for Events firing
- Write about events and observers in README
- Auto-cast flag values HOT 1
- Add Laravel 5.8 support
- New methods naming HOT 1
- [Feature Request] would it be possible to add the "reported" flag ? HOT 1
- Add getQualified***Column method
- undoActivate from HasActiveFlag not working HOT 1
- support laravel 7 HOT 2
- [question] what i do here wrong
- Add support laravel 9 HOT 2
- Remove laravel/legacy-factory dev dependency
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.
from laravel-eloquent-flag.