PHP Class App\Http\Controllers\BlogController

Inheritance: extends Controller
Show file Open project: forehalo/materialize-blog

Protected Properties

Property Type Description
$blog App\Repositories\PostRepository BlogRepository object.
$comment App\Repositories\CommentRepository CommentRepository object.

Public Methods

Method Description
__construct ( PostRepository $blog, CommentRepository $comment ) BlogController constructor.
backIndex ( ) : Illuminate\Contracts\View\Factory | Illuminate\View\View For back-end posts index.
body ( Illuminate\Http\Request $request, string $id ) : Illuminate\Contracts\View\Factory | Illuminate\Http\JsonResponse | Illuminate\View\View Get post body through ajax or redirect to 404.
comments ( Illuminate\Http\Request $request, $id ) : Illuminate\Http\JsonResponse Get comments belong to post gotten by {id}
create ( ) : Illuminate\Http\Response Show the form for creating a new resource.
destroy ( integer $id ) : Illuminate\Http\Response Remove the specified resource from storage.
edit ( integer $id ) : Illuminate\Http\Response Show the form for editing the specified resource.
favorite ( Illuminate\Http\Request $request, $id )
frontIndex ( ) : Illuminate\Contracts\View\Factory | Illuminate\View\View Display posts list order by created_at This controller return posts shown in collapsible view.
getUpload ( ) Get upload page
index ( ) : Illuminate\Http\Response Get all posts and make pagination.
normalIndex ( ) : Illuminate\Contracts\View\Factory | Illuminate\View\View Unlike 'frontIndex', this action used to show normal list of posts and post clicked will be shown in a single page.
publish ( Illuminate\Http\Request $request, $id ) : Illuminate\Http\JsonResponse Toggle post published status.
search ( Illuminate\Http\Request $request ) : Illuminate\Contracts\View\Factory | Illuminate\Http\RedirectResponse | Redirector | Illuminate\View\View Search in all posts.
show ( string $slug ) : Illuminate\Http\Response Display the specified resource.
store ( PostRequest $request ) : Illuminate\Http\Response Store a newly created resource in storage.
update ( Illuminate\Http\Request $request, integer $id ) : Illuminate\Http\Response Update the specified resource in storage.
upload ( Illuminate\Http\Request $request ) : Illuminate\Contracts\View\Factory | Illuminate\View\View Upload File with Markdown Form.

Method Details

__construct() public method

BlogController constructor.
public __construct ( PostRepository $blog, CommentRepository $comment )
$blog App\Repositories\PostRepository
$comment App\Repositories\CommentRepository

backIndex() public method

For back-end posts index.
public backIndex ( ) : Illuminate\Contracts\View\Factory | Illuminate\View\View
return Illuminate\Contracts\View\Factory | Illuminate\View\View

body() public method

Get post body through ajax or redirect to 404.
public body ( Illuminate\Http\Request $request, string $id ) : Illuminate\Contracts\View\Factory | Illuminate\Http\JsonResponse | Illuminate\View\View
$request Illuminate\Http\Request
$id string format: post-{id}
return Illuminate\Contracts\View\Factory | Illuminate\Http\JsonResponse | Illuminate\View\View

comments() public method

Get comments belong to post gotten by {id}
public comments ( Illuminate\Http\Request $request, $id ) : Illuminate\Http\JsonResponse
$request Illuminate\Http\Request
$id
return Illuminate\Http\JsonResponse

create() public method

Show the form for creating a new resource.
public create ( ) : Illuminate\Http\Response
return Illuminate\Http\Response

destroy() public method

Remove the specified resource from storage.
public destroy ( integer $id ) : Illuminate\Http\Response
$id integer
return Illuminate\Http\Response

edit() public method

Show the form for editing the specified resource.
public edit ( integer $id ) : Illuminate\Http\Response
$id integer
return Illuminate\Http\Response

favorite() public method

public favorite ( Illuminate\Http\Request $request, $id )
$request Illuminate\Http\Request

frontIndex() public method

Display posts list order by created_at This controller return posts shown in collapsible view.
public frontIndex ( ) : Illuminate\Contracts\View\Factory | Illuminate\View\View
return Illuminate\Contracts\View\Factory | Illuminate\View\View

getUpload() public method

Get upload page
public getUpload ( )

index() public method

Get all posts and make pagination.
public index ( ) : Illuminate\Http\Response
return Illuminate\Http\Response

normalIndex() public method

Unlike 'frontIndex', this action used to show normal list of posts and post clicked will be shown in a single page.
public normalIndex ( ) : Illuminate\Contracts\View\Factory | Illuminate\View\View
return Illuminate\Contracts\View\Factory | Illuminate\View\View

publish() public method

Toggle post published status.
public publish ( Illuminate\Http\Request $request, $id ) : Illuminate\Http\JsonResponse
$request Illuminate\Http\Request
$id
return Illuminate\Http\JsonResponse

show() public method

Display the specified resource.
public show ( string $slug ) : Illuminate\Http\Response
$slug string post url slug
return Illuminate\Http\Response

store() public method

Store a newly created resource in storage.
public store ( PostRequest $request ) : Illuminate\Http\Response
$request App\Http\Requests\PostRequest
return Illuminate\Http\Response

update() public method

Update the specified resource in storage.
public update ( Illuminate\Http\Request $request, integer $id ) : Illuminate\Http\Response
$request Illuminate\Http\Request
$id integer
return Illuminate\Http\Response

upload() public method

Upload File with Markdown Form.
public upload ( Illuminate\Http\Request $request ) : Illuminate\Contracts\View\Factory | Illuminate\View\View
$request Illuminate\Http\Request
return Illuminate\Contracts\View\Factory | Illuminate\View\View

Property Details

$blog protected property

BlogRepository object.
protected PostRepository,App\Repositories $blog
return App\Repositories\PostRepository

$comment protected property

CommentRepository object.
protected CommentRepository,App\Repositories $comment
return App\Repositories\CommentRepository