Changeset c433da6


Ignore:
Timestamp:
02/12/21 00:20:26 (3 years ago)
Author:
Özkan İliyaz <iliyaz_96@…>
Branches:
master
Children:
1f059b0
Parents:
0924b6c
Message:

modified logo

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • app/Models/User.php

    r0924b6c rc433da6  
    99class User extends Authenticatable
    1010{
    11         use Notifiable;
     11    use Notifiable;
    1212
    13         protected $table = "users";
     13    protected $table = "users";
    1414
    15         /**
    16         * The attributes that are mass assignable.
    17         *
    18         * @var array
    19         */
    20         protected $fillable = [
    21                 "name",
    22                 "surname",
    23                 "username",
    24                 "password",
    25                 "email",
     15    /**
     16    * The attributes that are mass assignable.
     17    *
     18    * @var array
     19    */
     20    protected $fillable = [
     21        "name",
     22        "surname",
     23        "username",
     24        "password",
     25        "email",
    2626        "country_code",
    2727        "mobile_number",
    28                 "role_id"
    29         ];
     28        "role_id"
     29    ];
    3030
    31         /**
    32         * The attributes that should be hidden for arrays.
    33         *
    34         * @var array
    35         */
    36         protected $hidden = [
    37                 "password",
    38                 "remember_token",
    39                 "is_active"
    40         ];
     31    /**
     32    * The attributes that should be hidden for arrays.
     33    *
     34    * @var array
     35    */
     36    protected $hidden = [
     37        "password",
     38        "remember_token",
     39        "is_active"
     40    ];
    4141
    42         /**
    43         * The attributes that should be cast to native types.
    44         *
    45         * @var array
    46         */
    47         protected $casts = [];
     42    /**
     43    * The attributes that should be cast to native types.
     44    *
     45    * @var array
     46    */
     47    protected $casts = [];
    4848
    4949
    50         public function role() {
    51                 return $this->belongsTo(Role::class);
    52         }
     50    public function role()
     51    {
     52        return $this->belongsTo(Role::class);
     53    }
    5354
    54         public function userProfile() {
     55    public function userProfile()
     56    {
    5557        return $this->hasOne(UserProfile::class);
    5658    }
    5759
    58         public function post() {
    59                 return $this->hasMany(Post::class);
    60         }
     60    public function post()
     61    {
     62        return $this->hasMany(Post::class);
     63    }
    6164
    62         public function comments()
    63         {
    64                 return $this->hasManyThrough(Comment::class, Post::class);
    65         }
     65    public function comments()
     66    {
     67        return $this->hasManyThrough(Comment::class, Post::class);
     68    }
    6669
    67         public function hasPermission($permission, $id = null, $any = false) {
     70    public function hasPermission($permission, $id = null, $any = false)
     71    {
    6872
    69                 $userPermissions = null;
    70                 $flag = null;
     73        $userPermissions = null;
     74        $flag = null;
    7175
    72                 if($id != null) $userPermissions = User::find($id)->role->permission->pluck("name");
    73                 else $userPermissions = $this->role->permission->pluck("name");
     76        if ($id != null) $userPermissions = User::find($id)->role->permission->pluck("name");
     77        else $userPermissions = $this->role->permission->pluck("name");
    7478
    75                 if($any) {
    76                         foreach($permission as $p) {
    77                                 if($this->hasPermission($p)) {
    78                                         return true;
    79                                 }
    80                         }
    81                         return false;
    82                 }
     79        if ($any) {
     80            foreach ($permission as $p) {
     81                if ($this->hasPermission($p)) {
     82                    return true;
     83                }
     84            }
     85            return false;
     86        }
    8387
    84                 if(is_string($permission)) {
    85                         return $userPermissions->contains($permission);
    86                 }
     88        if (is_string($permission)) {
     89            return $userPermissions->contains($permission);
     90        }
    8791
    88                 if(is_array($permission)) {
    89                         foreach($permission as $p) {
    90                                 if($this->hasPermission($p)) {
    91                                         $flag = true;
    92                                 } else {
    93                                         $flag = false; break;
    94                                 }
    95                         }
    96                 }
     92        if (is_array($permission)) {
     93            foreach ($permission as $p) {
     94                if ($this->hasPermission($p)) {
     95                    $flag = true;
     96                } else {
     97                    $flag = false;
     98                    break;
     99                }
     100            }
     101        }
    97102
    98                 return $flag;
    99         }
     103        return $flag;
     104    }
    100105
    101         public function hasAllPermissions(array $permissions = array(), $id = null, $any = false) {
    102                 return $this->hasPermission($permissions, $id, $any);
    103         }
     106    public function hasAllPermissions(array $permissions = array(), $id = null, $any = false)
     107    {
     108        return $this->hasPermission($permissions, $id, $any);
     109    }
    104110
    105         public function hasAnyPermission(array $permissions = array(), $id = null, $any = true) {
    106                 return $this->hasPermission($permissions, $id, $any);
    107         }
     111    public function hasAnyPermission(array $permissions = array(), $id = null, $any = true)
     112    {
     113        return $this->hasPermission($permissions, $id, $any);
     114    }
    108115
    109         public function hasRole($role) {
    110                 return $role === $this->role->name;
    111         }
     116    public function hasRole($role)
     117    {
     118        return $role === $this->role->name;
     119    }
    112120
    113         public function isAdmin() {
    114                 return $this->hasRole("admin");
    115         }
     121    public function isAdmin()
     122    {
     123        return $this->hasRole("admin");
     124    }
    116125
    117         public function isAdminOrEditor() {
    118                 return $this->hasRole("admin") || $this->hasRole("editor");
    119         }
     126    public function isAdminOrEditor()
     127    {
     128        return $this->hasRole("admin") || $this->hasRole("editor");
     129    }
    120130
    121         public function getFullName($id = null) {
     131    public function getFullName($id = null)
     132    {
    122133
    123                 if($id != null) {
    124                         $user = User::find($id);
    125                         return $user->name . " " . $user->surname;
    126                 }
     134        if ($id != null) {
     135            $user = User::find($id);
     136            return $user->name . " " . $user->surname;
     137        }
    127138
    128                 return $this->name . " " . $this->surname;
    129         }
     139        return $this->name . " " . $this->surname;
     140    }
    130141
    131         public function getPostsCount($id) {
    132                 return Post::where("user_id", $id)->count();
    133         }
     142    public function getPostsCount($id)
     143    {
     144        return Post::where("user_id", $id)->count();
     145    }
    134146
    135         public function generateTemporaryPassword($length = 20) {
    136                 return bcrypt(Str::random($length));
    137         }
     147    public function generateTemporaryPassword($length = 20)
     148    {
     149        return bcrypt(Str::random($length));
     150    }
    138151
    139         public function generateSecurityCode($min = 10000, $max = 99999) {
    140                 return rand($min, $max);
    141         }
     152    public function generateSecurityCode($min = 10000, $max = 99999)
     153    {
     154        return rand($min, $max);
     155    }
    142156
    143         public function generateVerifyToken($length = 32) {
    144                 return Str::random($length);
    145         }
     157    public function generateVerifyToken($length = 32)
     158    {
     159        return Str::random($length);
     160    }
    146161
    147     public function generateProfileLink($name, $surname) {
     162    public function generateProfileLink($name, $surname)
     163    {
    148164
    149165        $profileLinks = UserProfile::pluck("profile_link")->toArray();
     
    151167
    152168        foreach ($profileLinks as $profileLink) {
    153             if($profileLink == $link) {
     169            if ($profileLink == $link) {
    154170                $link .= "-" . strtolower(Str::random(10));
    155171                break;
     
    160176    }
    161177
    162     public function generateTechnoblogEmail($name, $surname) {
     178    public function generateTechnoblogEmail($name, $surname)
     179    {
    163180
    164181        $emails = UserProfile::pluck("technoblog_email")->toArray();
     
    166183
    167184        foreach ($emails as $email) {
    168             if($email == $newEmail) {
     185            if ($email == $newEmail) {
    169186                $position = strlen($name) + strlen($surname) + 1;
    170187                $id = UserProfile::latest("id")->first()->id + 1;
  • resources/views/auth/create_password.blade.php

    r0924b6c rc433da6  
    1010                                        <div class="col col-login mx-auto">
    1111                                                <div class="text-center mb-6">
    12                                                         <img src="/assets/images/logo1.png">
     12                                                        <img src="/assets/images/logo.png">
    1313                                                </div>
    1414
  • resources/views/auth/forgot.blade.php

    r0924b6c rc433da6  
    99                                <div class="row">
    1010                                        <div class="col-lg-12 text-center">
    11                                                 <img src="{{ asset("assets/images/logo1.png") }}">
     11                                                <img src="{{ asset("assets/images/logo.png") }}">
    1212                                        </div>
    1313                                        <div class="col col-login mx-auto pt-5 pb-7">
  • resources/views/auth/login.blade.php

    r0924b6c rc433da6  
    1010                                        <div class="col col-login mx-auto">
    1111                                                <div class="text-center mb-6">
    12                                                         <img src="/assets/images/logo1.png">
     12                                                        <img src="/assets/images/logo.png">
    1313                                                </div>
    1414                                                <form class="card" action="{{ route("auth.login") }}" method="post" accept-charset="utf-8">
  • resources/views/auth/verify_new_email.blade.php

    r0924b6c rc433da6  
    1010                                        <div class="col col-login mx-auto">
    1111                                                <div class="text-center mb-6">
    12                                                         <img src="/assets/images/logo1.png">
     12                                                        <img src="/assets/images/logo.png">
    1313                                                </div>
    1414
  • resources/views/fragments/auth/head.blade.php

    r0924b6c rc433da6  
    1010<meta name="HandheldFriendly" content="True">
    1111<meta name="MobileOptimized" content="320">
    12 <link rel="icon" href="{{ asset("assets/images/logo1.png") }}" type="image/x-icon" />
    13 <link rel="shortcut icon" type="image/x-icon" href="{{ asset("assets/images/logo1.png") }}" />
     12<link rel="icon" href="{{ asset("assets/images/logo.png") }}" type="image/x-icon" />
     13<link rel="shortcut icon" type="image/x-icon" href="{{ asset("assets/images/logo.png") }}" />
    1414
    1515<title>@yield("title")</title>
  • resources/views/fragments/dashboard/head.blade.php

    r0924b6c rc433da6  
    1111<meta name="HandheldFriendly" content="True">
    1212<meta name="MobileOptimized" content="320">
    13 <link rel="icon" href="{{ asset("assets/images/logo1.png") }}" type="image/x-icon" />
    14 <link rel="shortcut icon" type="image/x-icon" href="{{ asset("assets/images/logo1.png") }}" />
     13<link rel="icon" href="{{ asset("assets/images/logo.png") }}" type="image/x-icon" />
     14<link rel="shortcut icon" type="image/x-icon" href="{{ asset("assets/images/logo.png") }}" />
    1515
    1616<title>@yield("title")</title>
Note: See TracChangeset for help on using the changeset viewer.