Skip to content

niko898/laravel-blog-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# laravel-blog-api
first api application by Laravel

CONSPECT
https://www.youtube.com/watch?v=xjAvhg-mvSc&t=1013s&ab_channel=JamesLawrence


git init
git add . && git commit -m "initial commit"
git remote add origin git@github.com:niko898/laravel-blog-api.git

git push -u origin master


composer create-project laravel/laravel blog-api


php artisan make:model Post -m

php artisan migrate

php artisan make:controller Api\\PostController --model=Post

php artisan make:request StorePostRequest

php artisan make:controller Api\\AuthController

php artisan make:migration update_personal_tokens


php artisan make:model Comment -m

(with tinker we will add the new line in the database by console)
php artisan tinker
	use App\Models\Comment;
	$comment = New Comment;

	$comment->post_id = 2;

	$comment->user_id = 1;

	$comment->body = 'this a test comment';

	$comment->save();


	use App\Models\Post;
	$post = Post::find(1);

	$post->comment()->get();

	$post = Post::with('comment')->get();


php artisan make:resource PostResource

php artisan make:resource CommentResource




MINE

php artisan make:controller Api\\CommentController --model=Comment

php artisan make:request StoreCommentRequest

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published