Created
August 1, 2016 15:19
-
-
Save Moccine/cb39bba3f7243b2cb531ea136ec5ddd2 to your computer and use it in GitHub Desktop.
Share Link via Laravel Raw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App; | |
| use Illuminate\Foundation\Auth\User as Authenticatable; | |
| use Illuminate\Support\Facades\Auth; | |
| use Illuminate\Support\Facades\DB; | |
| class User extends Authenticatable | |
| { | |
| /** | |
| * The attributes that are mass assignable. | |
| * | |
| * @var array | |
| */ | |
| protected $fillable = [ | |
| 'name', 'email', 'password', | |
| ]; | |
| /** | |
| * The attributes that should be hidden for arrays. | |
| * | |
| * @var array | |
| */ | |
| protected $hidden = [ | |
| 'password', 'remember_token', | |
| ]; | |
| public function bookmarks() | |
| { | |
| return $this->hasMany(Bookmark::class); | |
| } | |
| public static function allUserCategories(){ | |
| return $categories=DB::table('bookmarks')->select ('category')->distinct()->get(); | |
| } | |
| public static function allUserLink(){ | |
| $bookmarks=DB::table('bookmarks')->where('user_id', Auth::user()->id)->get(); | |
| return $bookmarks; | |
| } | |
| public static function userMessage(){ | |
| return $categories=DB::table('bookmarks')->select ('category')->distinct()->get(); | |
| } | |
| public static function userThumbnail(){ | |
| return $categories=DB::table('bookmarks')->select ('id')->distinct()->get(); | |
| } | |
| public static function userHistory(){ | |
| return $categories=DB::table('bookmarks')->select ('created_at')->distinct()->get(); | |
| } | |
| public static function updateUserThumbnail($column, $value){ | |
| $user = Auth::user(); | |
| $user->$column = $value; | |
| $user->save(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment