code
stringlengths
31
1.39M
docstring
stringlengths
23
16.8k
func_name
stringlengths
1
126
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
166
url
stringlengths
50
220
license
stringclasses
7 values
public function restoreAny(User $user): bool { return $user->can('restore_any_post'); }
Determine whether the user can bulk restore.
restoreAny
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/PostPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/PostPolicy.php
MIT
public function replicate(User $user, Post $post): bool { return $user->can('replicate_post'); }
Determine whether the user can replicate.
replicate
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/PostPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/PostPolicy.php
MIT
public function reorder(User $user): bool { return $user->can('reorder_post'); }
Determine whether the user can reorder.
reorder
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/PostPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/PostPolicy.php
MIT
public function viewAny(User $user): bool { return $user->can('view_any_tag'); }
Determine whether the user can view any models.
viewAny
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function view(User $user, Tag $tag): bool { return $user->can('view_tag'); }
Determine whether the user can view the model.
view
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function create(User $user): bool { return $user->can('create_tag'); }
Determine whether the user can create models.
create
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function update(User $user, Tag $tag): bool { return $user->can('update_tag'); }
Determine whether the user can update the model.
update
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function delete(User $user, Tag $tag): bool { return $user->can('delete_tag'); }
Determine whether the user can delete the model.
delete
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function deleteAny(User $user): bool { return $user->can('delete_any_tag'); }
Determine whether the user can bulk delete.
deleteAny
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function forceDelete(User $user, Tag $tag): bool { return $user->can('force_delete_tag'); }
Determine whether the user can permanently delete.
forceDelete
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function forceDeleteAny(User $user): bool { return $user->can('force_delete_any_tag'); }
Determine whether the user can permanently bulk delete.
forceDeleteAny
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function restore(User $user, Tag $tag): bool { return $user->can('restore_tag'); }
Determine whether the user can restore.
restore
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function restoreAny(User $user): bool { return $user->can('restore_any_tag'); }
Determine whether the user can bulk restore.
restoreAny
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function replicate(User $user, Tag $tag): bool { return $user->can('replicate_tag'); }
Determine whether the user can replicate.
replicate
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
public function reorder(User $user): bool { return $user->can('reorder_tag'); }
Determine whether the user can reorder.
reorder
php
aureuserp/aureuserp
plugins/webkul/blogs/src/Policies/TagPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/blogs/src/Policies/TagPolicy.php
MIT
protected function processMessage(int $messageId, ?string $feedback): void { $message = Message::find($messageId); if (! $message) { return; } $this->record->addMessage([ 'type' => 'comment', 'body' => collect([ $message->activityType?->name ? $message->activityType?->name.' done' : null, $message->summary ? $message->summary : null, $message->body ? __('chatter::livewire/chatter-panel.process-message.original-note', ['body' => $message->body]) : null, $feedback ? __('chatter::livewire/chatter-panel.process-message.feedback', ['feedback' => $feedback]) : null, ])->filter()->implode(''), ]); $message->delete(); }
Process the message, add a comment, and delete the message.
processMessage
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Livewire/ChatterPanel.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Livewire/ChatterPanel.php
MIT
public function attachments(): array { return []; }
Get the attachments for the message. @return array<int, \Illuminate\Mail\Mailables\Attachment>
attachments
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Mail/FollowerMail.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Mail/FollowerMail.php
MIT
public function attachments(): array { $attachments = []; foreach ($this->attachmentData as $attachment) { if (isset($attachment['path'])) { $attachments[] = Attachment::fromPath($attachment['path']) ->as($attachment['name'] ?? null) ->withMime($attachment['mime'] ?? null); } elseif (isset($attachment['data'])) { $attachments[] = Attachment::fromData( fn () => $attachment['data'], $attachment['name'] )->withMime($attachment['mime'] ?? null); } } return $attachments; }
Get the attachments for the message. @return array<int, \Illuminate\Mail\Mailables\Attachment>
attachments
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Mail/MessageMail.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Mail/MessageMail.php
MIT
public function messages(): MorphMany { return $this->morphMany(Message::class, 'messageable') ->whereNot('type', 'activity') ->orderBy('created_at', 'desc'); }
Get all messages for this model
messages
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasChatter.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasChatter.php
MIT
public function markAsRead(): int { return $this->messages()->where('is_read', false)->update(['is_read' => true]); }
Mark all unread messages as read.
markAsRead
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasChatter.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasChatter.php
MIT
public function activities(): MorphMany { return $this->morphMany(Message::class, 'messageable') ->where('type', 'activity') ->orderBy('created_at', 'desc'); }
Get all activity messages for this model
activities
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasChatter.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasChatter.php
MIT
public function activityPlans(): mixed { return collect(); }
Get all activity plans for this model
activityPlans
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasChatter.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasChatter.php
MIT
public function replyToMessage(Message $parentMessage, array $data): Message { return $this->addMessage(array_merge($data, [ 'parent_id' => $parentMessage->id, 'company_id' => $parentMessage->company_id, 'activity_type_id' => $parentMessage->activity_type_id, ])); }
Add a reply to an existing message
replyToMessage
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasChatter.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasChatter.php
MIT
public function attachments(): MorphMany { return $this->morphMany(Attachment::class, 'messageable')->orderBy('created_at', 'desc'); }
Get all attachments for this model
attachments
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasChatter.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasChatter.php
MIT
public function isFollowedBy(Partner $partner): bool { return $this->followers() ->where('partner_id', $partner->id) ->exists(); }
Check if a partner is following this model
isFollowedBy
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasChatter.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasChatter.php
MIT
protected function getLogAttributes(): array { $normalized = []; foreach (property_exists($this, 'logAttributes') ? $this->logAttributes : [] as $key => $value) { if (is_int($key)) { $normalized[$value] = $value; } else { $normalized[$key] = $value; } } return $normalized; }
Get attributes to be logged. Override this in your model to specify which attributes to log
getLogAttributes
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasLogActivity.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasLogActivity.php
MIT
protected function parseRelationAttribute(string $key): ?array { if (! str_contains($key, '.')) { return null; } $parts = explode('.', $key); $relation = $parts[0]; $attribute = $parts[1]; return [$relation, $attribute]; }
Get the relationship and attribute to log from the attribute key
parseRelationAttribute
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasLogActivity.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasLogActivity.php
MIT
protected function getAllAttributeChanges(): array { $changes = []; $original = $this->getOriginal(); $current = $this->getDirty(); $logAttributes = $this->getLogAttributes(); foreach ($logAttributes as $key => $title) { if ($parsed = $this->parseRelationAttribute($key)) { [$relation, $attribute] = $parsed; $changes[$title] = $this->getRelationshipChanges($relation, $attribute, $original, $current); } else { $changes[$title] = $this->getDirectAttributeChanges($key, $original, $current); } } return array_filter($changes); }
Get changes for all monitored attributes
getAllAttributeChanges
php
aureuserp/aureuserp
plugins/webkul/chatter/src/Traits/HasLogActivity.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/chatter/src/Traits/HasLogActivity.php
MIT
public function definition(): array { return [ 'sequence' => $this->faker->randomNumber(), 'name' => $this->faker->word, 'day_of_week' => $this->faker->randomElement(['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']), 'day_period' => $this->faker->randomElement(['morning', 'afternoon', 'evening']), 'week_type' => $this->faker->randomElement(['odd', 'even', 'both']), 'display_type' => $this->faker->randomElement(['daily', 'weekly', 'monthly']), 'date_from' => $this->faker->date(), 'date_to' => $this->faker->date(), 'hour_from' => $this->faker->time(), 'hour_to' => $this->faker->time(), 'durations_days' => $this->faker->randomNumber(), 'calendar_id' => $this->faker->randomNumber(), 'user_id' => User::factory(), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/CalendarAttendanceFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/CalendarAttendanceFactory.php
MIT
public function definition(): array { return [ 'name' => $this->faker->name, 'tz' => $this->faker->timezone, 'hours_per_day' => $this->faker->randomFloat(2, 0, 24), 'status' => 1, 'two_weeks_calendar' => 0, 'flexible_hours' => 0, 'full_time_required_hours' => 0, 'user_id' => User::factory(), 'company_id' => Company::factory(), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/CalendarFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/CalendarFactory.php
MIT
public function definition(): array { return [ 'name' => $this->faker->name, 'manager_id' => Employee::factory(), 'company_id' => Company::factory(), 'color' => $this->faker->hexColor, ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/DepartmentFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/DepartmentFactory.php
MIT
public function definition(): array { return [ 'sequence' => $this->faker->randomNumber(), 'reason_code' => $this->faker->word, 'name' => $this->faker->word, ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/DepartureReasonFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/DepartureReasonFactory.php
MIT
public function definition(): array { return [ 'name' => $this->faker->name, 'color' => $this->faker->hexColor, 'user_id' => User::factory(), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/EmployeeCategoryFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/EmployeeCategoryFactory.php
MIT
public function definition(): array { return [ 'employee_id' => Employee::factory(), 'category_id' => EmployeeCategory::factory(), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/EmployeeEmployeeCategoryFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/EmployeeEmployeeCategoryFactory.php
MIT
public function definition(): array { return [ 'company_id' => Company::factory(), 'user_id' => User::factory(), 'creator_id' => User::factory(), 'calendar_id' => null, 'department_id' => Department::factory(), 'attendance_manager_id' => User::factory(), 'job_id' => EmployeeJobPosition::factory(), 'partner_id' => null, 'work_location_id' => WorkLocation::factory(), 'parent_id' => User::factory(), 'coach_id' => User::factory(), 'country_id' => Country::factory(), 'private_state_id' => State::factory(), 'private_country_id' => Country::factory(), 'country_of_birth' => Country::factory(), 'bank_account_id' => null, 'departure_reason_id' => DepartureReason::factory(), 'name' => $this->faker->name, 'job_title' => $this->faker->jobTitle, 'work_phone' => $this->faker->phoneNumber, 'mobile_phone' => $this->faker->phoneNumber, 'color' => $this->faker->safeColorName, 'work_email' => $this->faker->unique()->safeEmail, 'children' => $this->faker->numberBetween(0, 5), 'distance_home_work' => $this->faker->numberBetween(5, 100), 'km_home_work' => $this->faker->numberBetween(5, 100), 'distance_home_work_unit' => $this->faker->randomElement(['km', 'miles']), 'private_street1' => $this->faker->streetAddress, 'private_street2' => $this->faker->secondaryAddress, 'private_city' => $this->faker->city, 'private_zip' => $this->faker->postcode, 'private_phone' => $this->faker->phoneNumber, 'private_email' => $this->faker->unique()->safeEmail, 'lang' => $this->faker->languageCode, 'gender' => $this->faker->randomElement(), 'birthday' => $this->faker->date(), 'marital' => $this->faker->randomElement(['single', 'married', 'divorced', 'widowed']), 'spouse_complete_name' => $this->faker->name, 'spouse_birthdate' => $this->faker->date(), 'place_of_birth' => $this->faker->city, 'ssnid' => $this->faker->uuid, 'sinid' => $this->faker->uuid, 'identification_id' => $this->faker->uuid, 'passport_id' => $this->faker->uuid, 'permit_no' => $this->faker->uuid, 'visa_no' => $this->faker->uuid, 'certificate' => $this->faker->word, 'study_field' => $this->faker->word, 'study_school' => $this->faker->company, 'emergency_contact' => $this->faker->name, 'emergency_phone' => $this->faker->phoneNumber, 'employee_type' => $this->faker->randomElement(['full-time', 'part-time', 'contractor']), 'barcode' => $this->faker->ean13, 'pin' => $this->faker->randomNumber(6, true), 'private_car_plate' => $this->faker->bothify('??-###-##'), 'visa_expire' => $this->faker->date(), 'work_permit_expiration_date' => $this->faker->date(), 'departure_date' => $this->faker->optional()->date(), 'departure_description' => $this->faker->optional()->text, 'employee_properties' => $this->faker->optional()->json, 'additional_note' => $this->faker->optional()->text, 'notes' => $this->faker->optional()->text, 'is_active' => $this->faker->boolean(), 'is_flexible' => $this->faker->boolean(), 'is_fully_flexible' => $this->faker->boolean(), 'work_permit_scheduled_activity' => $this->faker->boolean(), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/EmployeeFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/EmployeeFactory.php
MIT
public function definition(): array { return [ 'sort' => $this->faker->randomNumber(), 'name' => $this->faker->word, 'description' => $this->faker->text, 'requirements' => $this->faker->text, 'expected_employees' => $this->faker->randomNumber(), 'no_of_employee' => $this->faker->randomNumber(), 'status' => true, 'no_of_recruitment' => $this->faker->randomNumber(), 'department_id' => Department::factory(), 'company_id' => Company::factory(), 'open_date' => $this->faker->date(), 'creator_id' => User::factory(), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/EmployeeJobPositionFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/EmployeeJobPositionFactory.php
MIT
public function definition(): array { return [ 'employee_id' => Employee::factory(), 'skill_id' => Skill::factory(), 'skill_level_id' => SkillLevel::factory(), 'start_date' => $this->faker->date(), 'notes' => $this->faker->text(), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/EmployeeSkillFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/EmployeeSkillFactory.php
MIT
public function definition(): array { return [ 'name' => $this->faker->name, 'country_id' => Country::factory(), 'creator_id' => User::factory(), 'code' => $this->faker->word, 'sequence' => $this->faker->numberBetween(1, 100), 'sort' => $this->faker->numberBetween(1, 100), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/EmploymentTypeFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/EmploymentTypeFactory.php
MIT
public function definition(): array { return [ 'name' => $this->faker->word, 'skill_type_id' => SkillTypeFactory::factory(), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/SkillFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/SkillFactory.php
MIT
public function definition(): array { return [ 'name' => $this->faker->name, 'skill_type_id' => SkillType::factory(), 'level' => $this->faker->numberBetween(5, 100), 'default_level' => 0, ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/SkillLevelFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/SkillLevelFactory.php
MIT
public function definition(): array { return [ 'name' => $this->faker->word, 'color' => $this->faker->hexColor, 'status' => 1, ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/SkillTypeFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/SkillTypeFactory.php
MIT
public function definition(): array { return [ 'company_id' => Company::factory(), 'user_id' => User::factory(), 'name' => $this->faker->name, 'location_type' => $this->faker->word, 'location_number' => $this->faker->numberBetween(1, 100), 'active' => 1, ]; }
Define the model's default state. @return array<string, mixed>
definition
php
aureuserp/aureuserp
plugins/webkul/employees/database/factories/WorkLocationFactory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/factories/WorkLocationFactory.php
MIT
public function run($parameters = []) { $this->call([ EmploymentTypeSeeder::class, EmployeeJobPositionSeeder::class, SkillTypeSeeder::class, SkillSeeder::class, SkillLevelSeeder::class, WorkLocationSeeder::class, EmployeeCategorySeeder::class, DepartureReasonSeeder::class, CalendarSeeder::class, CalendarAttendanceSeeder::class, ActivityPlanTemplateSeeder::class, EmployeeSeeder::class, DepartmentSeeder::class, ]); }
Seed the application's database. @param array $parameters @return void
run
php
aureuserp/aureuserp
plugins/webkul/employees/database/seeders/DatabaseSeeder.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/database/seeders/DatabaseSeeder.php
MIT
protected static function newFactory(): CalendarFactory { return CalendarFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/Calendar.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/Calendar.php
MIT
protected static function newFactory(): CalendarAttendanceFactory { return CalendarAttendanceFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/CalendarAttendance.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/CalendarAttendance.php
MIT
protected static function newFactory(): DepartureReasonFactory { return DepartureReasonFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/DepartureReason.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/DepartureReason.php
MIT
protected static function newFactory(): EmployeeFactory { return EmployeeFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/Employee.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/Employee.php
MIT
protected static function boot() { parent::boot(); static::saved(function (self $employee) { if (! $employee->partner_id) { $employee->handlePartnerCreation($employee); } else { $employee->handlePartnerUpdation($employee); } }); }
Bootstrap the model and its traits.
boot
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/Employee.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/Employee.php
MIT
private function handlePartnerCreation(self $employee): void { $partner = $employee->partner()->create([ 'account_type' => 'individual', 'sub_type' => 'employee', 'creator_id' => Auth::id(), 'name' => $employee?->name, 'email' => $employee?->work_email ?? $employee?->private_email, 'job_title' => $employee?->job_title, 'phone' => $employee?->work_phone, 'mobile' => $employee?->mobile_phone, 'color' => $employee?->color, 'parent_id' => $employee?->parent_id, 'company_id' => $employee?->company_id, 'user_id' => $employee?->user_id, ]); $employee->partner_id = $partner->id; $employee->save(); }
Handle the creation of the partner.
handlePartnerCreation
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/Employee.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/Employee.php
MIT
private function handlePartnerUpdation(self $employee): void { $partner = Partner::updateOrCreate( ['id' => $employee->partner_id], [ 'account_type' => 'individual', 'sub_type' => 'employee', 'creator_id' => Auth::id(), 'name' => $employee?->name, 'email' => $employee?->work_email ?? $employee?->private_email, 'job_title' => $employee?->job_title, 'phone' => $employee?->work_phone, 'mobile' => $employee?->mobile_phone, 'color' => $employee?->color, 'parent_id' => $employee?->parent_id, 'company_id' => $employee?->company_id, 'user_id' => $employee?->user_id, ] ); if ($employee->partner_id !== $partner->id) { $employee->partner_id = $partner->id; $employee->save(); } }
Handle the updation of the partner.
handlePartnerUpdation
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/Employee.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/Employee.php
MIT
protected static function newFactory(): EmployeeCategoryFactory { return EmployeeCategoryFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/EmployeeCategory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/EmployeeCategory.php
MIT
public function category() { return $this->belongsTo(EmployeeCategory::class, 'category_id'); }
Relationship to fetch the category (skill).
category
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/EmployeeEmployeeCategory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/EmployeeEmployeeCategory.php
MIT
protected static function newFactory(): EmployeeEmployeeCategoryFactory { return EmployeeEmployeeCategoryFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/EmployeeEmployeeCategory.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/EmployeeEmployeeCategory.php
MIT
protected static function newFactory(): EmployeeSkillFactory { return EmployeeSkillFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/EmployeeSkill.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/EmployeeSkill.php
MIT
protected static function newFactory(): EmploymentTypeFactory { return EmploymentTypeFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/EmploymentType.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/EmploymentType.php
MIT
protected static function newFactory(): SkillFactory { return SkillFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/Skill.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/Skill.php
MIT
protected static function newFactory(): SkillLevelFactory { return SkillLevelFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/SkillLevel.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/SkillLevel.php
MIT
protected static function newFactory(): SkillTypeFactory { return SkillTypeFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/SkillType.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/SkillType.php
MIT
public function scopeActive(Builder $query): Builder { return $query->where('is_active', true); }
Scope a query to only include active work locations.
scopeActive
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/WorkLocation.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/WorkLocation.php
MIT
protected static function newFactory(): WorkLocationFactory { return WorkLocationFactory::new(); }
Get the factory instance for the model.
newFactory
php
aureuserp/aureuserp
plugins/webkul/employees/src/Models/WorkLocation.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Models/WorkLocation.php
MIT
public function viewAny(User $user): bool { return $user->can('view_any_activity::plan'); }
Determine whether the user can view any models.
viewAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function view(User $user, ActivityPlan $activityPlan): bool { return $user->can('view_activity::plan'); }
Determine whether the user can view the model.
view
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function create(User $user): bool { return $user->can('create_activity::plan'); }
Determine whether the user can create models.
create
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function update(User $user, ActivityPlan $activityPlan): bool { return $user->can('update_activity::plan'); }
Determine whether the user can update the model.
update
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function delete(User $user, ActivityPlan $activityPlan): bool { return $user->can('delete_activity::plan'); }
Determine whether the user can delete the model.
delete
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function deleteAny(User $user): bool { return $user->can('delete_any_activity::plan'); }
Determine whether the user can bulk delete.
deleteAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function forceDelete(User $user, ActivityPlan $activityPlan): bool { return $user->can('force_delete_activity::plan'); }
Determine whether the user can permanently delete.
forceDelete
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function forceDeleteAny(User $user): bool { return $user->can('force_delete_any_activity::plan'); }
Determine whether the user can permanently bulk delete.
forceDeleteAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function restore(User $user, ActivityPlan $activityPlan): bool { return $user->can('restore_activity::plan'); }
Determine whether the user can restore.
restore
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function restoreAny(User $user): bool { return $user->can('restore_any_activity::plan'); }
Determine whether the user can bulk restore.
restoreAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function replicate(User $user, ActivityPlan $activityPlan): bool { return $user->can('replicate_activity::plan'); }
Determine whether the user can replicate.
replicate
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function reorder(User $user): bool { return $user->can('reorder_activity::plan'); }
Determine whether the user can reorder.
reorder
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/ActivityPlanPolicy.php
MIT
public function viewAny(User $user): bool { return $user->can('view_any_calendar'); }
Determine whether the user can view any models.
viewAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function view(User $user, Calendar $calendar): bool { return $user->can('view_calendar'); }
Determine whether the user can view the model.
view
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function create(User $user): bool { return $user->can('create_calendar'); }
Determine whether the user can create models.
create
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function update(User $user, Calendar $calendar): bool { return $user->can('update_calendar'); }
Determine whether the user can update the model.
update
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function delete(User $user, Calendar $calendar): bool { return $user->can('delete_calendar'); }
Determine whether the user can delete the model.
delete
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function deleteAny(User $user): bool { return $user->can('delete_any_calendar'); }
Determine whether the user can bulk delete.
deleteAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function forceDelete(User $user, Calendar $calendar): bool { return $user->can('force_delete_calendar'); }
Determine whether the user can permanently delete.
forceDelete
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function forceDeleteAny(User $user): bool { return $user->can('force_delete_any_calendar'); }
Determine whether the user can permanently bulk delete.
forceDeleteAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function restore(User $user, Calendar $calendar): bool { return $user->can('restore_calendar'); }
Determine whether the user can restore.
restore
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function restoreAny(User $user): bool { return $user->can('restore_any_calendar'); }
Determine whether the user can bulk restore.
restoreAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function replicate(User $user, Calendar $calendar): bool { return $user->can('replicate_calendar'); }
Determine whether the user can replicate.
replicate
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function reorder(User $user): bool { return $user->can('reorder_calendar'); }
Determine whether the user can reorder.
reorder
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/CalendarPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/CalendarPolicy.php
MIT
public function viewAny(User $user): bool { return $user->can('view_any_department'); }
Determine whether the user can view any models.
viewAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function view(User $user, Department $department): bool { return $user->can('view_department'); }
Determine whether the user can view the model.
view
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function create(User $user): bool { return $user->can('create_department'); }
Determine whether the user can create models.
create
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function update(User $user, Department $department): bool { return $user->can('update_department'); }
Determine whether the user can update the model.
update
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function delete(User $user, Department $department): bool { return $user->can('delete_department'); }
Determine whether the user can delete the model.
delete
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function deleteAny(User $user): bool { return $user->can('delete_any_department'); }
Determine whether the user can bulk delete.
deleteAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function forceDelete(User $user, Department $department): bool { return $user->can('force_delete_department'); }
Determine whether the user can permanently delete.
forceDelete
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function forceDeleteAny(User $user): bool { return $user->can('force_delete_any_department'); }
Determine whether the user can permanently bulk delete.
forceDeleteAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function restore(User $user, Department $department): bool { return $user->can('restore_department'); }
Determine whether the user can restore.
restore
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function restoreAny(User $user): bool { return $user->can('restore_any_department'); }
Determine whether the user can bulk restore.
restoreAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function replicate(User $user, Department $department): bool { return $user->can('replicate_department'); }
Determine whether the user can replicate.
replicate
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function reorder(User $user): bool { return $user->can('reorder_department'); }
Determine whether the user can reorder.
reorder
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartmentPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartmentPolicy.php
MIT
public function viewAny(User $user): bool { return $user->can('view_any_departure::reason'); }
Determine whether the user can view any models.
viewAny
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartureReasonPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartureReasonPolicy.php
MIT
public function view(User $user, DepartureReason $departureReason): bool { return $user->can('view_departure::reason'); }
Determine whether the user can view the model.
view
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartureReasonPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartureReasonPolicy.php
MIT
public function create(User $user): bool { return $user->can('create_departure::reason'); }
Determine whether the user can create models.
create
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartureReasonPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartureReasonPolicy.php
MIT
public function update(User $user, DepartureReason $departureReason): bool { return $user->can('update_departure::reason'); }
Determine whether the user can update the model.
update
php
aureuserp/aureuserp
plugins/webkul/employees/src/Policies/DepartureReasonPolicy.php
https://github.com/aureuserp/aureuserp/blob/master/plugins/webkul/employees/src/Policies/DepartureReasonPolicy.php
MIT