Ignore:
Timestamp:
09/30/21 00:32:27 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
24a616f
Parents:
582789f
Message:

added departments, edited users and added user settings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • app/Models/User.php

    r582789f r194a359  
    2424        "password",
    2525        "email",
    26         "country_code",
    2726        "mobile_number",
    2827        "role_id"
     
    5049    public function role() {
    5150        return $this->belongsTo(Role::class);
    52     }
    53 
    54     public function post() {
    55         return $this->hasMany(Post::class);
    56     }
    57 
    58     public function comments()
    59     {
    60         return $this->hasManyThrough(Comment::class, Post::class);
    6151    }
    6252
     
    10898
    10999    public function isAdmin() {
    110         return $this->hasRole("admin");
     100        return $this->hasRole("Admin");
    111101    }
    112102
    113103    public function isAdminOrEditor() {
    114         return $this->hasRole("admin") || $this->hasRole("editor");
     104        return $this->hasRole("Admin") || $this->hasRole("Referent");
    115105    }
    116106
     
    123113
    124114        return $this->name . " " . $this->surname;
    125     }
    126 
    127     public function getPostsCount($id) {
    128         return Post::where("user_id", $id)->count();
    129115    }
    130116
     
    140126        return Str::random($length);
    141127    }
     128
    142129}
Note: See TracChangeset for help on using the changeset viewer.