Skip to content
This repository was archived by the owner on Aug 20, 2023. It is now read-only.

Commit 137eae5

Browse files
Added README_TR
1 parent 8ffd902 commit 137eae5

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

README_TR.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Favoriteable
2+
Bir model kaynağını, favorilere ekleme veya hatırlamak için kaydetme gibi farklı kullanım özelliklerinin kolayca uyarlanabilmesine imkan tanıyan, Laravel tabanlı yapılar için basit ve kullanışlı trait yapısı.
3+
4+
[![GitHub license](https://img.shields.io/github/license/codeforms/Favoriteable)](https://github.com/codeforms/Favoriteable/blob/master/LICENSE)
5+
![GitHub release (latest by date)](https://img.shields.io/github/v/release/codeforms/Favoriteable)
6+
[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](https://github.com/codeforms/Favoriteable/releases)
7+
8+
## Kurulum
9+
* Migration dosyasını kullanarak veri tabanı için gerekli tabloları oluşturun;
10+
``` php artisan migrate```
11+
* Favoriteable trait dosyasını, kullanmak istediğiniz model dosyalarına ekleyiniz;
12+
```php
13+
namespace App\Post;
14+
15+
use CodeForms\Repositories\Favorite\Favoriteable;
16+
use Illuminate\Database\Eloquent\Model;
17+
/**
18+
*
19+
*/
20+
class Post extends Model
21+
{
22+
use Favoriteable;
23+
}
24+
```
25+
## Kullanım
26+
```php
27+
$post = Post::find(1);
28+
29+
$post->hasFavorite(); // $post'un, mevcut kullanıcı için (auth()->user()) favori kaydını sorgular
30+
$post->addFavorite(); // $post'u, mevcut kullanıcı için (auth()->user()) 'favori' olarak kaydeder
31+
$post->unFavorite(); // $post'un, mevcut kullanıcıya ait (auth()->user()) 'favori' kaydını siler
32+
$post->deleteFavorites(); // $post'a ait tüm favori kayıtlarını siler
33+
```
34+
---
35+
* (Tercihen) UserFavorites trait dosyasını ```User``` model'a ekleyin;
36+
UserFavorites trait dosyası, kullanıcıların favori olarak kaydettiği kayıtları object olarak almayı sağlar.
37+
```php
38+
namespace App;
39+
40+
use Illuminate\Contracts\Auth\MustVerifyEmail;
41+
use Illuminate\Foundation\Auth\User as Authenticatable;
42+
use Illuminate\Notifications\Notifiable;
43+
use CodeForms\Repositories\Like\UserFavorites;
44+
45+
class User extends Authenticatable
46+
{
47+
use Notifiable, UserFavorites;
48+
```
49+
50+
#### UserFavorites kullanımı
51+
```php
52+
/**
53+
* UserFavorites
54+
*/
55+
$user = User::find(1);
56+
57+
$user->favorites(); // bir kullanıcının tüm favori kayıtlarını object olarak alır
58+
$user->hasFavorite(); // bir kullanıcının favori kaydını sorgular
59+
$user->deleteFavorites(); // bir kullanıcıya ait tüm favori kayıtlarını siler
60+
```

0 commit comments

Comments
 (0)