feat(LRL App): init V0
This commit is contained in:
27
app/Models/Contact.php
Normal file
27
app/Models/Contact.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Contact extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'firstname',
|
||||
'lastname',
|
||||
'email',
|
||||
'address',
|
||||
'subject',
|
||||
'message',
|
||||
];
|
||||
|
||||
public static function getAttributeLabel(string $attribute): string
|
||||
{
|
||||
return __("contacts.fields.$attribute");
|
||||
}
|
||||
public function getFullNameAttribute(): string
|
||||
{
|
||||
return "{$this->firstname} {$this->lastname}";
|
||||
}
|
||||
}
|
||||
57
app/Models/Member.php
Normal file
57
app/Models/Member.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Member extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'keycloak_id',
|
||||
'status',
|
||||
'nature',
|
||||
'group_id',
|
||||
'lastname',
|
||||
'firstname',
|
||||
'email',
|
||||
'company',
|
||||
'date_of_birth',
|
||||
'address',
|
||||
'zipcode',
|
||||
'city',
|
||||
'country',
|
||||
'phone1',
|
||||
'phone2',
|
||||
'public_membership'
|
||||
];
|
||||
|
||||
public static function getAttributeLabel(string $attribute): string
|
||||
{
|
||||
return __("members.fields.$attribute");
|
||||
}
|
||||
|
||||
public function getFullNameAttribute(): string
|
||||
{
|
||||
return "{$this->firstname} {$this->lastname}";
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function group(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MemberGroup::class);
|
||||
}
|
||||
|
||||
public function memberships(): HasMany
|
||||
{
|
||||
return $this->hasMany(Membership::class);
|
||||
}
|
||||
}
|
||||
24
app/Models/MemberGroup.php
Normal file
24
app/Models/MemberGroup.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class MemberGroup extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description'
|
||||
];
|
||||
|
||||
public static function getAttributeLabel(string $attribute): string
|
||||
{
|
||||
return __('member_groups.fields.' . $attribute);
|
||||
}
|
||||
|
||||
public function members(): HasMany
|
||||
{
|
||||
return $this->hasMany(Member::class);
|
||||
}
|
||||
}
|
||||
50
app/Models/Membership.php
Normal file
50
app/Models/Membership.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
class Membership extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'member_id',
|
||||
'admin_id',
|
||||
'package_id',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'status',
|
||||
'amount',
|
||||
'payment_status',
|
||||
];
|
||||
|
||||
|
||||
public static function getAttributeLabel(string $attribute): string
|
||||
{
|
||||
return __("membership.fields.$attribute");
|
||||
}
|
||||
|
||||
public function member(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Member::class);
|
||||
}
|
||||
|
||||
public function author(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'admin_id');
|
||||
}
|
||||
|
||||
public function package(): HasOne
|
||||
{
|
||||
return $this->hasOne(Package::class);
|
||||
}
|
||||
|
||||
public function services(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Service::class, 'services_memberships', 'membership_id', 'service_id');
|
||||
}
|
||||
|
||||
}
|
||||
26
app/Models/Package.php
Normal file
26
app/Models/Package.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Package extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'identifier',
|
||||
'name',
|
||||
'description',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public static function getAttributeLabel(string $attribute): string
|
||||
{
|
||||
return __('packages.fields.' . $attribute);
|
||||
}
|
||||
|
||||
public function memberships(): HasMany
|
||||
{
|
||||
return $this->hasMany(Membership::class);
|
||||
}
|
||||
}
|
||||
21
app/Models/Service.php
Normal file
21
app/Models/Service.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Service extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'identifier',
|
||||
'name',
|
||||
'description',
|
||||
'url',
|
||||
'icon',
|
||||
];
|
||||
|
||||
public static function getAttributeLabel(string $attribute): string
|
||||
{
|
||||
return __('services.fields.' . $attribute);
|
||||
}
|
||||
}
|
||||
55
app/Models/User.php
Normal file
55
app/Models/User.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasRoles, HasFactory, Notifiable, TwoFactorAuthenticatable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
|
||||
public function members(): hasMany
|
||||
{
|
||||
return $this->hasMany(Member::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user