Skip to content

Commit

Permalink
Merge pull request #23 from NisanurBulut/dev-sayhilaravel
Browse files Browse the repository at this point in the history
Dev sayhilaravel is complated
  • Loading branch information
NisanurBulut authored Mar 26, 2021
2 parents 1987e7e + 26f8f00 commit 6edba2e
Show file tree
Hide file tree
Showing 116 changed files with 43,055 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ yarn-debug.log*
yarn-error.log*
*/node_modules
*/backend/node_modules/*/
*/vendor/*/
*/config.js
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,28 @@ This study demonstrates the use of the React-Jquery library.In addition, the use

![SayHiReactQuery](https://github.com/NisanurBulut/SayHiCode/blob/master/Trailers/Trailer_SayHiReactQuery.gif)

### SayHiLaravel
<hr>
With this study, a social media application was made using Laravel Framework at a simple level. Sqlite database has been used.Tailwind CSS is used in frontend design.

- The user can become a member of the application.
- The user can log in to the application.
- The user can share posts.
- The user can view other users' posts.
- The user can delete their own post.
- The user can like the post.
- The posts belonging to the user are listed separately.
- The user's email, name, user name, membership period information are displayed.
- When the user likes, an e-mail is sent via mailtrap.
- Spam sending has been blocked.
- The liking is soft-deleting.
## Installation
- composer global require laravel
- laravel new projectName
- php artisan serve
- npm install tailwindcss
- npm install

![SayHiLaravel](https://github.com/NisanurBulut/SayHiCode/blob/master/Trailers/Trailer_SayHiLaravel.gif)
## Helpfull Websites
[json-to-js](https://www.convertonline.io/convert/json-to-js) [fusioncharts](https://www.fusioncharts.com/) [React-Query-Tutorial](https://www.youtube.com/watch?v=XRbnuiAbV3g&list=PLzJ4DQ1UrlRb0XiN-vecbtZ31t-Q2Z6BD&ab_channel=boraoren) [FakeStoreAPI](https://fakestoreapi.herokuapp.com/)
[json-to-js](https://www.convertonline.io/convert/json-to-js) [fusioncharts](https://www.fusioncharts.com/) [React-Query-Tutorial](https://www.youtube.com/watch?v=XRbnuiAbV3g&list=PLzJ4DQ1UrlRb0XiN-vecbtZ31t-Q2Z6BD&ab_channel=boraoren) [FakeStoreAPI](https://fakestoreapi.herokuapp.com/)[Laravel-artisan-blog](https://www.yasird.com/laravel-5-artisan-nedir/) [MailTrap](https://mailtrap.io/) [HeroIcons](https://heroicons.com/)
15 changes: 15 additions & 0 deletions SayHiLaravel/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
49 changes: 49 additions & 0 deletions SayHiLaravel/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=project
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
5 changes: 5 additions & 0 deletions SayHiLaravel/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
13 changes: 13 additions & 0 deletions SayHiLaravel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
13 changes: 13 additions & 0 deletions SayHiLaravel/.styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
php:
preset: laravel
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true
2 changes: 2 additions & 0 deletions SayHiLaravel/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
37 changes: 37 additions & 0 deletions SayHiLaravel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## SayHiLaravel
* php artisan serve

### Documentation
#### PHP Artisan
Artisan, Laravel ile birlikte gelen Komut Satırı Arayüzüne (CLI) denir.Komut satırından proje yönetimi sağlar.Uygulama geliştirirken bizim işimizi hızlandıracak bir takım komutlar içermektedir.
Örnek vermek gerekirse uygulama geliştirirke çokca duyduğunuz model-view-controller gibi dosyaları elle oluşturmak yerine tek komutla oluşturup projeye entegre edebilirsiniz. Veya database işlemlerini yine tek komutla yapabilirsiniz.
#### Blade
Blade aslında bir şablon sistemidir. İçerisine alışık olduğunu PHP kodlarını da yazabilmeniz bir çok yazılımcının Laravel öğrenirken kendini rahat hissetmesini sağlamaktadır.Bir ana şablon tanımlar ve diğer sayfaları bu şablonu ‘extend’ ederek oluşturursunuz.

### Installation
- composer global require laravel
- laravel new projectName
- php artisan serve
- npm install tailwindcss
- npm install

### Commands
- php artisan make:controller Auth/RegisterController
- php artisan make:controller DashboardController
- php artisan make:controller Auth/LoginController
- php artisan make:controller Auth/LogoutController
- php artisan make:controller PostController
- php artisan make:model Post -m -f
- php artisan tinker App\Models\Post::factory()->times(200)->create(['user_id'=>2])
- php artisan make:migration create_likes_table --create=likes
- php artisan make:model Like
- php artisan make:controller PostLikeController
- composer require barryvdh/laravel-debugbar --dev
- php artisan make:policy PostPolicy
- php artisan make:component Post
- php artisan make:component UserCard
- php artisan make:mail PostLiked --markdown=emails.posts.post_liked
- php artisan make:migration add_soft_deletes_tolikes_table --table=likes

### Helpfull Resources
[Laravel-artisan-blog](https://www.yasird.com/laravel-5-artisan-nedir/) [MailTrap](https://mailtrap.io/) [HeroIcons](https://heroicons.com/)
41 changes: 41 additions & 0 deletions SayHiLaravel/app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
41 changes: 41 additions & 0 deletions SayHiLaravel/app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];

/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}
28 changes: 28 additions & 0 deletions SayHiLaravel/app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class LoginController extends Controller
{
public function __construct(){
$this->middleware(['guest']);
}
public function index(){
return view('auth.login');
}

public function store(Request $request){
$this->validate($request, [
'username'=>'required',
'password'=>'required',
]);
if(!auth()->attempt($request->only('username','password'), $request->remember))
{
return back()->with('status','Invalid Login Details');
};
return redirect()->route('posts');
}
}
14 changes: 14 additions & 0 deletions SayHiLaravel/app/Http/Controllers/Auth/LogoutController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class LogoutController extends Controller
{
public function store(){
auth()->logout();
return redirect()->route('login');
}
}
38 changes: 38 additions & 0 deletions SayHiLaravel/app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;

class RegisterController extends Controller
{
public function __construct(){
$this->middleware(['guest']);
}
public function index(){
return view('auth.register');
}
public function store(Request $request) {
// validation
$this->validate($request, [
'name' => 'required|max:255',
'username'=>'required|max:255',
'email'=>'required|email|max:255',
'password'=>'required|confirmed',
]);
// store user
User::create([
'name'=>$request->name,
'email'=>$request->email,
'username'=>$request->username,
'password'=>Hash::make($request->password)
]);
// sign the user
auth()->attempt($request->only('email','password'));
// redirect
return redirect()->route('posts');
}
}
13 changes: 13 additions & 0 deletions SayHiLaravel/app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
Loading

0 comments on commit 6edba2e

Please sign in to comment.