Exemplo n.º 1
0
 public function doSubmit(Request $request, $id)
 {
     $post = Post::find($id);
     $publicStatus = PostStatus::where('key', '=', 'published')->first();
     $post->status_id = $publicStatus->id;
     $post->save();
     return redirect("/backend/post");
 }
Exemplo n.º 2
0
                        <?php 
$statuses = \App\Models\Posts\PostStatus::all();
?>
                        @foreach($statuses as $status)
                            <div class="item {{ $post->status_id == $status->id ? "active" : ""  }}"
                                 data-value="{{$status->id}}">
                                {{$status->key}}
                            </div>
                        @endforeach

                    </div>
                </div>
            </div>
        @else
            <?php 
$draft = \App\Models\Posts\PostStatus::where('key', '=', 'draft')->first();
?>
            <input type="hidden" name="post[status][id]" value="{{$post->status_id or $draft->id}}"/>
        @endif

        @if($type == "ADD")
            <button class="ui button" tabindex="0">บันทึกข่าวประกาศใหม่</button>
        @else
            <button class="ui button" tabindex="0">บันทึกข่าวประกาศ</button>
        @endif

        <a href="{{$cancel}}" class="ui red button" tabindex="0">ยกเลิก</a>

    </form>

    <script>