repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
GrafiteInc/Builder | src/Packages/Billing/app/Services/AccountService.php | AccountService.withinLimit | public function withinLimit($model, $key = 'user_id', $value = null)
{
if (is_null($value)) {
$value = $this->user->id;
}
$limit = $this->config['plans'][$this->subscription->stripe_plan]['limits'][$model];
if (Schema::hasTable($model)) {
$newModel = DB::tab... | php | public function withinLimit($model, $key = 'user_id', $value = null)
{
if (is_null($value)) {
$value = $this->user->id;
}
$limit = $this->config['plans'][$this->subscription->stripe_plan]['limits'][$model];
if (Schema::hasTable($model)) {
$newModel = DB::tab... | [
"public",
"function",
"withinLimit",
"(",
"$",
"model",
",",
"$",
"key",
"=",
"'user_id'",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"user",
"->",
"id",... | Check if user is in their limits
@param string $model
@return bool | [
"Check",
"if",
"user",
"is",
"in",
"their",
"limits"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Services/AccountService.php#L96-L131 |
GrafiteInc/Builder | src/Packages/Billing/app/Services/AccountService.php | AccountService.creditsUsed | public function creditsUsed($model, $key = 'user_id', $value = null)
{
if (is_null($value)) {
$value = $this->user->id;
}
$credits = $this->config['plans'][$this->subscription->stripe_plan]['credits'];
$appModel = app($model);
$creditQuery = $appModel->where($k... | php | public function creditsUsed($model, $key = 'user_id', $value = null)
{
if (is_null($value)) {
$value = $this->user->id;
}
$credits = $this->config['plans'][$this->subscription->stripe_plan]['credits'];
$appModel = app($model);
$creditQuery = $appModel->where($k... | [
"public",
"function",
"creditsUsed",
"(",
"$",
"model",
",",
"$",
"key",
"=",
"'user_id'",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"user",
"->",
"id",... | Credits used by user
@param string $model
@return int | [
"Credits",
"used",
"by",
"user"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Services/AccountService.php#L138-L169 |
GrafiteInc/Builder | src/Packages/Billing/app/Services/AccountService.php | AccountService.creditsAvailable | public function creditsAvailable($model)
{
$credits = $this->config['plans'][$this->subscription->stripe_plan]['credits'];
return $credits['limit'] - $this->creditsUsed($model);
} | php | public function creditsAvailable($model)
{
$credits = $this->config['plans'][$this->subscription->stripe_plan]['credits'];
return $credits['limit'] - $this->creditsUsed($model);
} | [
"public",
"function",
"creditsAvailable",
"(",
"$",
"model",
")",
"{",
"$",
"credits",
"=",
"$",
"this",
"->",
"config",
"[",
"'plans'",
"]",
"[",
"$",
"this",
"->",
"subscription",
"->",
"stripe_plan",
"]",
"[",
"'credits'",
"]",
";",
"return",
"$",
"... | Checks credits available for user
@param string $model
@return int | [
"Checks",
"credits",
"available",
"for",
"user"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Services/AccountService.php#L176-L180 |
GrafiteInc/Builder | src/Packages/Billing/app/Services/AccountService.php | AccountService.clause | public function clause($key, $method, $model = null)
{
$query = null;
if (! is_null($model)) {
$appModel = app($model);
$query = DB::table(app($model)->table);
if ($this->inBillingCycle) {
$customer = Customer::retrieve($this->user->meta->stripe_... | php | public function clause($key, $method, $model = null)
{
$query = null;
if (! is_null($model)) {
$appModel = app($model);
$query = DB::table(app($model)->table);
if ($this->inBillingCycle) {
$customer = Customer::retrieve($this->user->meta->stripe_... | [
"public",
"function",
"clause",
"(",
"$",
"key",
",",
"$",
"method",
",",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"query",
"=",
"null",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"model",
")",
")",
"{",
"$",
"appModel",
"=",
"app",
"(",
"$",
... | Subscription clause method
@param string $key
@param Closure $method
@param string $model
@return void | [
"Subscription",
"clause",
"method"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Services/AccountService.php#L189-L211 |
GrafiteInc/Builder | src/Packages/Features/app/Providers/FeatureServiceProvider.php | FeatureServiceProvider.register | public function register()
{
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Features', \App\Facades\Features::class);
$this->app->singleton('FeatureService', function ($app) {
return app(\App\Services\FeatureService::class);
});
} | php | public function register()
{
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Features', \App\Facades\Features::class);
$this->app->singleton('FeatureService', function ($app) {
return app(\App\Services\FeatureService::class);
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"loader",
"=",
"\\",
"Illuminate",
"\\",
"Foundation",
"\\",
"AliasLoader",
"::",
"getInstance",
"(",
")",
";",
"$",
"loader",
"->",
"alias",
"(",
"'Features'",
",",
"\\",
"App",
"\\",
"Facades",
"\\"... | Register any application services. | [
"Register",
"any",
"application",
"services",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Features/app/Providers/FeatureServiceProvider.php#L27-L36 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Requests/UserInviteRequest.php | UserInviteRequest.authorize | public function authorize()
{
if (auth()->user()->can('admin')) {
return true;
} elseif (auth()->user()->isTeamAdmin($this->route('id'))) {
return true;
}
return false;
} | php | public function authorize()
{
if (auth()->user()->can('admin')) {
return true;
} elseif (auth()->user()->isTeamAdmin($this->route('id'))) {
return true;
}
return false;
} | [
"public",
"function",
"authorize",
"(",
")",
"{",
"if",
"(",
"auth",
"(",
")",
"->",
"user",
"(",
")",
"->",
"can",
"(",
"'admin'",
")",
")",
"{",
"return",
"true",
";",
"}",
"elseif",
"(",
"auth",
"(",
")",
"->",
"user",
"(",
")",
"->",
"isTea... | Determine if the user is authorized to make this request.
@return bool | [
"Determine",
"if",
"the",
"user",
"is",
"authorized",
"to",
"make",
"this",
"request",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Requests/UserInviteRequest.php#L14-L23 |
GrafiteInc/Builder | src/Packages/Notifications/app/Notifications/GeneralNotification.php | GeneralNotification.toMail | public function toMail($notifiable)
{
return (new MailMessage)
->line('Hey '.$notifiable->name)
->line('We have a notfiication for you.')
->line($this->info['title'])
->line($this->info['details'])
->action('Visit here for more info', url('/user/no... | php | public function toMail($notifiable)
{
return (new MailMessage)
->line('Hey '.$notifiable->name)
->line('We have a notfiication for you.')
->line($this->info['title'])
->line($this->info['details'])
->action('Visit here for more info', url('/user/no... | [
"public",
"function",
"toMail",
"(",
"$",
"notifiable",
")",
"{",
"return",
"(",
"new",
"MailMessage",
")",
"->",
"line",
"(",
"'Hey '",
".",
"$",
"notifiable",
"->",
"name",
")",
"->",
"line",
"(",
"'We have a notfiication for you.'",
")",
"->",
"line",
"... | Build the mail representation of the notification.
@param mixed $notifiable
@return \Illuminate\Notifications\Messages\MailMessage | [
"Build",
"the",
"mail",
"representation",
"of",
"the",
"notification",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Notifications/app/Notifications/GeneralNotification.php#L47-L55 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/TeamController.php | TeamController.index | public function index(Request $request)
{
$teams = $this->service->paginated($request->user()->id);
return view('team.index')->with('teams', $teams);
} | php | public function index(Request $request)
{
$teams = $this->service->paginated($request->user()->id);
return view('team.index')->with('teams', $teams);
} | [
"public",
"function",
"index",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"teams",
"=",
"$",
"this",
"->",
"service",
"->",
"paginated",
"(",
"$",
"request",
"->",
"user",
"(",
")",
"->",
"id",
")",
";",
"return",
"view",
"(",
"'team.index'",
")"... | Display a listing of the resource.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/TeamController.php#L27-L31 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/TeamController.php | TeamController.search | public function search(Request $request)
{
$teams = $this->service->search($request->user()->id, $request->search);
return view('team.index')->with('teams', $teams);
} | php | public function search(Request $request)
{
$teams = $this->service->search($request->user()->id, $request->search);
return view('team.index')->with('teams', $teams);
} | [
"public",
"function",
"search",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"teams",
"=",
"$",
"this",
"->",
"service",
"->",
"search",
"(",
"$",
"request",
"->",
"user",
"(",
")",
"->",
"id",
",",
"$",
"request",
"->",
"search",
")",
";",
"retu... | Display a listing of the resource searched.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource",
"searched",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/TeamController.php#L38-L42 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/TeamController.php | TeamController.store | public function store(TeamCreateRequest $request)
{
try {
$result = $this->service->create(Auth::id(), $request->except('_token'));
if ($result) {
return redirect('teams/'.$result->id.'/edit')->with('message', 'Successfully created');
}
retur... | php | public function store(TeamCreateRequest $request)
{
try {
$result = $this->service->create(Auth::id(), $request->except('_token'));
if ($result) {
return redirect('teams/'.$result->id.'/edit')->with('message', 'Successfully created');
}
retur... | [
"public",
"function",
"store",
"(",
"TeamCreateRequest",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"create",
"(",
"Auth",
"::",
"id",
"(",
")",
",",
"$",
"request",
"->",
"except",
"(",
"'_token'",
... | Store a newly created resource in storage.
@param \Illuminate\Http\TeamCreateRequest $request
@return \Illuminate\Http\Response | [
"Store",
"a",
"newly",
"created",
"resource",
"in",
"storage",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/TeamController.php#L60-L73 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/TeamController.php | TeamController.showByName | public function showByName($name)
{
$team = $this->service->findByName($name);
if (Gate::allows('team-member', [$team, Auth::user()])) {
return view('team.show')->with('team', $team);
}
return back();
} | php | public function showByName($name)
{
$team = $this->service->findByName($name);
if (Gate::allows('team-member', [$team, Auth::user()])) {
return view('team.show')->with('team', $team);
}
return back();
} | [
"public",
"function",
"showByName",
"(",
"$",
"name",
")",
"{",
"$",
"team",
"=",
"$",
"this",
"->",
"service",
"->",
"findByName",
"(",
"$",
"name",
")",
";",
"if",
"(",
"Gate",
"::",
"allows",
"(",
"'team-member'",
",",
"[",
"$",
"team",
",",
"Au... | Display the specified team.
@param int $id
@return \Illuminate\Http\Response | [
"Display",
"the",
"specified",
"team",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/TeamController.php#L81-L90 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/TeamController.php | TeamController.edit | public function edit($id)
{
$team = $this->service->find($id);
return view('team.edit')->with('team', $team);
} | php | public function edit($id)
{
$team = $this->service->find($id);
return view('team.edit')->with('team', $team);
} | [
"public",
"function",
"edit",
"(",
"$",
"id",
")",
"{",
"$",
"team",
"=",
"$",
"this",
"->",
"service",
"->",
"find",
"(",
"$",
"id",
")",
";",
"return",
"view",
"(",
"'team.edit'",
")",
"->",
"with",
"(",
"'team'",
",",
"$",
"team",
")",
";",
... | Show the form for editing the specified resource.
@param int $id
@return \Illuminate\Http\Response | [
"Show",
"the",
"form",
"for",
"editing",
"the",
"specified",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/TeamController.php#L98-L102 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/TeamController.php | TeamController.update | public function update(TeamUpdateRequest $request, $id)
{
try {
$result = $this->service->update($id, $request->except('_token'));
if ($result) {
return back()->with('message', 'Successfully updated');
}
return back()->with('message', 'Failed... | php | public function update(TeamUpdateRequest $request, $id)
{
try {
$result = $this->service->update($id, $request->except('_token'));
if ($result) {
return back()->with('message', 'Successfully updated');
}
return back()->with('message', 'Failed... | [
"public",
"function",
"update",
"(",
"TeamUpdateRequest",
"$",
"request",
",",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"update",
"(",
"$",
"id",
",",
"$",
"request",
"->",
"except",
"(",
"'_token'",
")... | Update the specified resource in storage.
@param \Illuminate\Http\Request $request
@param int $id
@return \Illuminate\Http\Response | [
"Update",
"the",
"specified",
"resource",
"in",
"storage",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/TeamController.php#L111-L124 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/TeamController.php | TeamController.destroy | public function destroy($id)
{
try {
$result = $this->service->destroy(Auth::user(), $id);
if ($result) {
return redirect('teams')->with('message', 'Successfully deleted');
}
return redirect('teams')->with('message', 'Failed to delete');
... | php | public function destroy($id)
{
try {
$result = $this->service->destroy(Auth::user(), $id);
if ($result) {
return redirect('teams')->with('message', 'Successfully deleted');
}
return redirect('teams')->with('message', 'Failed to delete');
... | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"destroy",
"(",
"Auth",
"::",
"user",
"(",
")",
",",
"$",
"id",
")",
";",
"if",
"(",
"$",
"result",
")",
"{",
"return... | Remove the specified resource from storage.
@param int $id
@return \Illuminate\Http\Response | [
"Remove",
"the",
"specified",
"resource",
"from",
"storage",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/TeamController.php#L132-L145 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/TeamController.php | TeamController.inviteMember | public function inviteMember(UserInviteRequest $request, $id)
{
try {
$result = $this->service->invite(Auth::user(), $id, $request->email);
if ($result) {
return back()->with('message', 'Successfully invited member');
}
return back()->with('m... | php | public function inviteMember(UserInviteRequest $request, $id)
{
try {
$result = $this->service->invite(Auth::user(), $id, $request->email);
if ($result) {
return back()->with('message', 'Successfully invited member');
}
return back()->with('m... | [
"public",
"function",
"inviteMember",
"(",
"UserInviteRequest",
"$",
"request",
",",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"invite",
"(",
"Auth",
"::",
"user",
"(",
")",
",",
"$",
"id",
",",
"$",
"... | Invite a team member
@param int $id
@return \Illuminate\Http\Response | [
"Invite",
"a",
"team",
"member"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/TeamController.php#L153-L166 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/TeamController.php | TeamController.removeMember | public function removeMember($id, $userId)
{
try {
$result = $this->service->remove(Auth::user(), $id, $userId);
if ($result) {
return back()->with('message', 'Successfully removed member');
}
return back()->with('message', 'Failed to remove ... | php | public function removeMember($id, $userId)
{
try {
$result = $this->service->remove(Auth::user(), $id, $userId);
if ($result) {
return back()->with('message', 'Successfully removed member');
}
return back()->with('message', 'Failed to remove ... | [
"public",
"function",
"removeMember",
"(",
"$",
"id",
",",
"$",
"userId",
")",
"{",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"remove",
"(",
"Auth",
"::",
"user",
"(",
")",
",",
"$",
"id",
",",
"$",
"userId",
")",
";",
... | Remove a team member
@param int $userId
@return \Illuminate\Http\Response | [
"Remove",
"a",
"team",
"member"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/TeamController.php#L174-L187 |
GrafiteInc/Builder | src/Packages/Activity/app/Services/ActivityService.php | ActivityService.getByUser | public function getByUser($userId, $paginate = null)
{
$query = $this->model->where('user_id', $userId);
if (!is_null($paginate)) {
return $query->paginate($paginate);
}
return $query->get();
} | php | public function getByUser($userId, $paginate = null)
{
$query = $this->model->where('user_id', $userId);
if (!is_null($paginate)) {
return $query->paginate($paginate);
}
return $query->get();
} | [
"public",
"function",
"getByUser",
"(",
"$",
"userId",
",",
"$",
"paginate",
"=",
"null",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"model",
"->",
"where",
"(",
"'user_id'",
",",
"$",
"userId",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
... | All activities
@return Collection | [
"All",
"activities"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Activity/app/Services/ActivityService.php#L19-L28 |
GrafiteInc/Builder | src/Packages/Activity/app/Services/ActivityService.php | ActivityService.log | public function log($description = '')
{
$payload = [
'user_id' => auth()->id(),
'description' => $description,
'request' => json_encode([
'url' => request()->url(),
'method' => request()->method(),
'query' => request()->ful... | php | public function log($description = '')
{
$payload = [
'user_id' => auth()->id(),
'description' => $description,
'request' => json_encode([
'url' => request()->url(),
'method' => request()->method(),
'query' => request()->ful... | [
"public",
"function",
"log",
"(",
"$",
"description",
"=",
"''",
")",
"{",
"$",
"payload",
"=",
"[",
"'user_id'",
"=>",
"auth",
"(",
")",
"->",
"id",
"(",
")",
",",
"'description'",
"=>",
"$",
"description",
",",
"'request'",
"=>",
"json_encode",
"(",
... | Create an activity record
@param string $description
@return Activity | [
"Create",
"an",
"activity",
"record"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Activity/app/Services/ActivityService.php#L36-L52 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Middleware/Permissions.php | Permissions.handle | public function handle($request, Closure $next, $requestPermissionCollection)
{
$requestPermissions = explode('|', $requestPermissionCollection);
foreach ($request->user()->roles as $role) {
foreach ($role->permissions as $permission) {
$userPermissionCollection[] = $per... | php | public function handle($request, Closure $next, $requestPermissionCollection)
{
$requestPermissions = explode('|', $requestPermissionCollection);
foreach ($request->user()->roles as $role) {
foreach ($role->permissions as $permission) {
$userPermissionCollection[] = $per... | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
",",
"$",
"requestPermissionCollection",
")",
"{",
"$",
"requestPermissions",
"=",
"explode",
"(",
"'|'",
",",
"$",
"requestPermissionCollection",
")",
";",
"foreach",
"(",
"$",
... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Middleware/Permissions.php#L36-L53 |
GrafiteInc/Builder | src/Packages/Activity/app/Providers/ActivityServiceProvider.php | ActivityServiceProvider.register | public function register()
{
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Activity', \App\Facades\Activity::class);
$this->app->singleton('ActivityService', function ($app) {
return app(\App\Services\ActivityService::class);
});
} | php | public function register()
{
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Activity', \App\Facades\Activity::class);
$this->app->singleton('ActivityService', function ($app) {
return app(\App\Services\ActivityService::class);
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"loader",
"=",
"\\",
"Illuminate",
"\\",
"Foundation",
"\\",
"AliasLoader",
"::",
"getInstance",
"(",
")",
";",
"$",
"loader",
"->",
"alias",
"(",
"'Activity'",
",",
"\\",
"App",
"\\",
"Facades",
"\\"... | Register any application services. | [
"Register",
"any",
"application",
"services",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Activity/app/Providers/ActivityServiceProvider.php#L21-L30 |
GrafiteInc/Builder | src/Packages/Notifications/app/Http/Controllers/Admin/NotificationController.php | NotificationController.index | public function index(Request $request)
{
$notifications = $this->service->paginated();
return view('admin.notifications.index')->with('notifications', $notifications);
} | php | public function index(Request $request)
{
$notifications = $this->service->paginated();
return view('admin.notifications.index')->with('notifications', $notifications);
} | [
"public",
"function",
"index",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"notifications",
"=",
"$",
"this",
"->",
"service",
"->",
"paginated",
"(",
")",
";",
"return",
"view",
"(",
"'admin.notifications.index'",
")",
"->",
"with",
"(",
"'notifications'... | Display a listing of the resource.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Notifications/app/Http/Controllers/Admin/NotificationController.php#L23-L27 |
GrafiteInc/Builder | src/Packages/Notifications/app/Http/Controllers/Admin/NotificationController.php | NotificationController.edit | public function edit($id)
{
$notification = $this->service->find($id);
return view('admin.notifications.edit')->with('notification', $notification);
} | php | public function edit($id)
{
$notification = $this->service->find($id);
return view('admin.notifications.edit')->with('notification', $notification);
} | [
"public",
"function",
"edit",
"(",
"$",
"id",
")",
"{",
"$",
"notification",
"=",
"$",
"this",
"->",
"service",
"->",
"find",
"(",
"$",
"id",
")",
";",
"return",
"view",
"(",
"'admin.notifications.edit'",
")",
"->",
"with",
"(",
"'notification'",
",",
... | Show the form for editing the specified resource.
@param int $id
@return \Illuminate\Http\Response | [
"Show",
"the",
"form",
"for",
"editing",
"the",
"specified",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Notifications/app/Http/Controllers/Admin/NotificationController.php#L75-L79 |
GrafiteInc/Builder | src/Packages/Notifications/app/Http/Controllers/Admin/NotificationController.php | NotificationController.update | public function update(NotificationUpdateRequest $request, $id)
{
$result = $this->service->update($id, $request->except('_token'));
if ($result) {
return back()->with('message', 'Successfully updated');
}
return back()->with('errors', ['Failed to update']);
} | php | public function update(NotificationUpdateRequest $request, $id)
{
$result = $this->service->update($id, $request->except('_token'));
if ($result) {
return back()->with('message', 'Successfully updated');
}
return back()->with('errors', ['Failed to update']);
} | [
"public",
"function",
"update",
"(",
"NotificationUpdateRequest",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"update",
"(",
"$",
"id",
",",
"$",
"request",
"->",
"except",
"(",
"'_token'",
")",
")"... | Update the specified resource in storage.
@param \Illuminate\Http\NotificationUpdateRequest $request
@param int $id
@return \Illuminate\Http\Response | [
"Update",
"the",
"specified",
"resource",
"in",
"storage",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Notifications/app/Http/Controllers/Admin/NotificationController.php#L88-L97 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/Traits/HasTeams.php | HasTeams.joinTeam | public function joinTeam($teamId, $userId)
{
$team = $this->team->find($teamId);
$user = $this->model->find($userId);
$user->teams()->attach($team);
} | php | public function joinTeam($teamId, $userId)
{
$team = $this->team->find($teamId);
$user = $this->model->find($userId);
$user->teams()->attach($team);
} | [
"public",
"function",
"joinTeam",
"(",
"$",
"teamId",
",",
"$",
"userId",
")",
"{",
"$",
"team",
"=",
"$",
"this",
"->",
"team",
"->",
"find",
"(",
"$",
"teamId",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"(",
"$",
"... | Join a team
@param integer $teamId
@param integer $userId
@return void | [
"Join",
"a",
"team"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/Traits/HasTeams.php#L14-L20 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/Traits/HasTeams.php | HasTeams.leaveTeam | public function leaveTeam($teamId, $userId)
{
$team = $this->team->find($teamId);
$user = $this->model->find($userId);
$user->teams()->detach($team);
} | php | public function leaveTeam($teamId, $userId)
{
$team = $this->team->find($teamId);
$user = $this->model->find($userId);
$user->teams()->detach($team);
} | [
"public",
"function",
"leaveTeam",
"(",
"$",
"teamId",
",",
"$",
"userId",
")",
"{",
"$",
"team",
"=",
"$",
"this",
"->",
"team",
"->",
"find",
"(",
"$",
"teamId",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"(",
"$",
... | Leave a team
@param integer $teamId
@param integer $userId
@return void | [
"Leave",
"a",
"team"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/Traits/HasTeams.php#L29-L35 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/Traits/HasTeams.php | HasTeams.leaveAllTeams | public function leaveAllTeams($userId)
{
$user = $this->model->find($userId);
$user->teams()->detach();
} | php | public function leaveAllTeams($userId)
{
$user = $this->model->find($userId);
$user->teams()->detach();
} | [
"public",
"function",
"leaveAllTeams",
"(",
"$",
"userId",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"(",
"$",
"userId",
")",
";",
"$",
"user",
"->",
"teams",
"(",
")",
"->",
"detach",
"(",
")",
";",
"}"
] | Leave all teams
@param integer $teamId
@param integer $userId
@return void | [
"Leave",
"all",
"teams"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/Traits/HasTeams.php#L44-L48 |
GrafiteInc/Builder | src/Packages/Starter/database/seeds/DatabaseSeeder.php | DatabaseSeeder.run | public function run()
{
Model::unguard();
$this->call(RolesTableSeeder::class);
$this->call(UserTableSeeder::class);
Model::reguard();
} | php | public function run()
{
Model::unguard();
$this->call(RolesTableSeeder::class);
$this->call(UserTableSeeder::class);
Model::reguard();
} | [
"public",
"function",
"run",
"(",
")",
"{",
"Model",
"::",
"unguard",
"(",
")",
";",
"$",
"this",
"->",
"call",
"(",
"RolesTableSeeder",
"::",
"class",
")",
";",
"$",
"this",
"->",
"call",
"(",
"UserTableSeeder",
"::",
"class",
")",
";",
"Model",
"::... | Run the database seeds.
@return void | [
"Run",
"the",
"database",
"seeds",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/database/seeds/DatabaseSeeder.php#L13-L21 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/User/PasswordController.php | PasswordController.password | public function password(Request $request)
{
$user = $request->user();
if ($user) {
return view('user.password')
->with('user', $user);
}
return back()->withErrors(['Could not find user']);
} | php | public function password(Request $request)
{
$user = $request->user();
if ($user) {
return view('user.password')
->with('user', $user);
}
return back()->withErrors(['Could not find user']);
} | [
"public",
"function",
"password",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
")",
";",
"if",
"(",
"$",
"user",
")",
"{",
"return",
"view",
"(",
"'user.password'",
")",
"->",
"with",
"(",
"'user'",
... | User wants to change their password
@return \Illuminate\Http\Response | [
"User",
"wants",
"to",
"change",
"their",
"password"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/User/PasswordController.php#L30-L40 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/User/PasswordController.php | PasswordController.update | public function update(PasswordUpdateRequest $request)
{
$password = $request->new_password;
if (Hash::check($request->old_password, Auth::user()->password)) {
$this->resetPassword(Auth::user(), $password);
return redirect('user/settings')
->with('message', '... | php | public function update(PasswordUpdateRequest $request)
{
$password = $request->new_password;
if (Hash::check($request->old_password, Auth::user()->password)) {
$this->resetPassword(Auth::user(), $password);
return redirect('user/settings')
->with('message', '... | [
"public",
"function",
"update",
"(",
"PasswordUpdateRequest",
"$",
"request",
")",
"{",
"$",
"password",
"=",
"$",
"request",
"->",
"new_password",
";",
"if",
"(",
"Hash",
"::",
"check",
"(",
"$",
"request",
"->",
"old_password",
",",
"Auth",
"::",
"user",... | Change the user's password and return
@param PasswordUpdateRequest $request
@return Response | [
"Change",
"the",
"user",
"s",
"password",
"and",
"return"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/User/PasswordController.php#L48-L59 |
GrafiteInc/Builder | src/GrafiteBuilderProvider.php | GrafiteBuilderProvider.register | public function register()
{
/*
|--------------------------------------------------------------------------
| Providers
|--------------------------------------------------------------------------
*/
$this->app->register(FormMakerProvider::class);
$this->app->... | php | public function register()
{
/*
|--------------------------------------------------------------------------
| Providers
|--------------------------------------------------------------------------
*/
$this->app->register(FormMakerProvider::class);
$this->app->... | [
"public",
"function",
"register",
"(",
")",
"{",
"/*\n |--------------------------------------------------------------------------\n | Providers\n |--------------------------------------------------------------------------\n */",
"$",
"this",
"->",
"app",
"->",
"r... | Register the service provider. | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/GrafiteBuilderProvider.php#L34-L65 |
GrafiteInc/Builder | src/Packages/Starter/app/Notifications/NewAccountEmail.php | NewAccountEmail.toMail | public function toMail($notifiable)
{
return (new MailMessage())
->greeting('Hey '.$notifiable->name)
->line('You\'ve been given a new account on '.url('/'))
->line('EM: '.$notifiable->email)
->line('PW: '.$this->password)
->line('Click the link be... | php | public function toMail($notifiable)
{
return (new MailMessage())
->greeting('Hey '.$notifiable->name)
->line('You\'ve been given a new account on '.url('/'))
->line('EM: '.$notifiable->email)
->line('PW: '.$this->password)
->line('Click the link be... | [
"public",
"function",
"toMail",
"(",
"$",
"notifiable",
")",
"{",
"return",
"(",
"new",
"MailMessage",
"(",
")",
")",
"->",
"greeting",
"(",
"'Hey '",
".",
"$",
"notifiable",
"->",
"name",
")",
"->",
"line",
"(",
"'You\\'ve been given a new account on '",
".... | Build the mail representation of the notification.
@param mixed $notifiable
@return \Illuminate\Notifications\Messages\MailMessage | [
"Build",
"the",
"mail",
"representation",
"of",
"the",
"notification",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Notifications/NewAccountEmail.php#L47-L56 |
GrafiteInc/Builder | src/Console/Starter.php | Starter.handle | public function handle()
{
$fileSystem = new Filesystem();
$files = $fileSystem->allFiles(__DIR__.'/../Packages/Starter');
$this->info('These files will be published');
foreach ($files as $file) {
$this->line(str_replace(__DIR__.'/../Packages/Starter/', '', $file));
... | php | public function handle()
{
$fileSystem = new Filesystem();
$files = $fileSystem->allFiles(__DIR__.'/../Packages/Starter');
$this->info('These files will be published');
foreach ($files as $file) {
$this->line(str_replace(__DIR__.'/../Packages/Starter/', '', $file));
... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"fileSystem",
"=",
"new",
"Filesystem",
"(",
")",
";",
"$",
"files",
"=",
"$",
"fileSystem",
"->",
"allFiles",
"(",
"__DIR__",
".",
"'/../Packages/Starter'",
")",
";",
"$",
"this",
"->",
"info",
"(",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Console/Starter.php#L33-L103 |
GrafiteInc/Builder | src/Console/Starter.php | Starter.defaultFileChanger | public function defaultFileChanger()
{
$files = [
base_path('config/auth.php'),
base_path('config/services.php'),
];
foreach ($files as $file) {
$contents = file_get_contents($file);
$contents = str_replace('App\User::class', 'App\Models\User:... | php | public function defaultFileChanger()
{
$files = [
base_path('config/auth.php'),
base_path('config/services.php'),
];
foreach ($files as $file) {
$contents = file_get_contents($file);
$contents = str_replace('App\User::class', 'App\Models\User:... | [
"public",
"function",
"defaultFileChanger",
"(",
")",
"{",
"$",
"files",
"=",
"[",
"base_path",
"(",
"'config/auth.php'",
")",
",",
"base_path",
"(",
"'config/services.php'",
")",
",",
"]",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
... | Clean up files from the install of Laravel etc. | [
"Clean",
"up",
"files",
"from",
"the",
"install",
"of",
"Laravel",
"etc",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Console/Starter.php#L108-L120 |
GrafiteInc/Builder | src/Packages/Notifications/app/Http/Controllers/User/NotificationController.php | NotificationController.index | public function index(Request $request)
{
$notifications = $this->service->userBasedPaginated(Auth::id());
return view('notifications.index')->with('notifications', $notifications);
} | php | public function index(Request $request)
{
$notifications = $this->service->userBasedPaginated(Auth::id());
return view('notifications.index')->with('notifications', $notifications);
} | [
"public",
"function",
"index",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"notifications",
"=",
"$",
"this",
"->",
"service",
"->",
"userBasedPaginated",
"(",
"Auth",
"::",
"id",
"(",
")",
")",
";",
"return",
"view",
"(",
"'notifications.index'",
")",
... | Display a listing of the resource.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Notifications/app/Http/Controllers/User/NotificationController.php#L23-L27 |
GrafiteInc/Builder | src/Packages/Notifications/app/Http/Controllers/User/NotificationController.php | NotificationController.search | public function search(Request $request)
{
$notifications = $this->service->search($request->search, Auth::id());
return view('notifications.index')->with('notifications', $notifications);
} | php | public function search(Request $request)
{
$notifications = $this->service->search($request->search, Auth::id());
return view('notifications.index')->with('notifications', $notifications);
} | [
"public",
"function",
"search",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"notifications",
"=",
"$",
"this",
"->",
"service",
"->",
"search",
"(",
"$",
"request",
"->",
"search",
",",
"Auth",
"::",
"id",
"(",
")",
")",
";",
"return",
"view",
"("... | Display a listing of the resource searched.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource",
"searched",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Notifications/app/Http/Controllers/User/NotificationController.php#L34-L38 |
GrafiteInc/Builder | src/Packages/Notifications/app/Http/Controllers/User/NotificationController.php | NotificationController.read | public function read($uuid)
{
$notification = $this->service->findByUuid($uuid);
$this->service->markAsRead($notification->id);
return view('notifications.show')->with('notification', $notification);
} | php | public function read($uuid)
{
$notification = $this->service->findByUuid($uuid);
$this->service->markAsRead($notification->id);
return view('notifications.show')->with('notification', $notification);
} | [
"public",
"function",
"read",
"(",
"$",
"uuid",
")",
"{",
"$",
"notification",
"=",
"$",
"this",
"->",
"service",
"->",
"findByUuid",
"(",
"$",
"uuid",
")",
";",
"$",
"this",
"->",
"service",
"->",
"markAsRead",
"(",
"$",
"notification",
"->",
"id",
... | Display the specified resource.
@param int $id
@return \Illuminate\Http\Response | [
"Display",
"the",
"specified",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Notifications/app/Http/Controllers/User/NotificationController.php#L46-L52 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/Admin/UserController.php | UserController.search | public function search(Request $request)
{
if (! $request->search) {
return redirect('admin/users');
}
$users = $this->service->search($request->search);
return view('admin.users.index')->with('users', $users);
} | php | public function search(Request $request)
{
if (! $request->search) {
return redirect('admin/users');
}
$users = $this->service->search($request->search);
return view('admin.users.index')->with('users', $users);
} | [
"public",
"function",
"search",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"search",
")",
"{",
"return",
"redirect",
"(",
"'admin/users'",
")",
";",
"}",
"$",
"users",
"=",
"$",
"this",
"->",
"service",
"->",
"sea... | Display a listing of the resource searched.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource",
"searched",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/Admin/UserController.php#L34-L42 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/Admin/UserController.php | UserController.postInvite | public function postInvite(UserInviteRequest $request)
{
$result = $this->service->invite($request->except(['_token', '_method']));
if ($result) {
return redirect('admin/users')->with('message', 'Successfully invited');
}
return back()->with('errors', ['Failed to invite... | php | public function postInvite(UserInviteRequest $request)
{
$result = $this->service->invite($request->except(['_token', '_method']));
if ($result) {
return redirect('admin/users')->with('message', 'Successfully invited');
}
return back()->with('errors', ['Failed to invite... | [
"public",
"function",
"postInvite",
"(",
"UserInviteRequest",
"$",
"request",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"invite",
"(",
"$",
"request",
"->",
"except",
"(",
"[",
"'_token'",
",",
"'_method'",
"]",
")",
")",
";",
"... | Show the form for inviting a customer.
@return \Illuminate\Http\Response | [
"Show",
"the",
"form",
"for",
"inviting",
"a",
"customer",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/Admin/UserController.php#L59-L68 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/Admin/UserController.php | UserController.switchToUser | public function switchToUser($id)
{
if ($this->service->switchToUser($id)) {
return redirect('dashboard')->with('message', 'You\'ve switched users.');
}
return redirect('dashboard')->with('errors', ['Could not switch users']);
} | php | public function switchToUser($id)
{
if ($this->service->switchToUser($id)) {
return redirect('dashboard')->with('message', 'You\'ve switched users.');
}
return redirect('dashboard')->with('errors', ['Could not switch users']);
} | [
"public",
"function",
"switchToUser",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"service",
"->",
"switchToUser",
"(",
"$",
"id",
")",
")",
"{",
"return",
"redirect",
"(",
"'dashboard'",
")",
"->",
"with",
"(",
"'message'",
",",
"'You\\'ve... | Switch to a different User profile
@return \Illuminate\Http\Response | [
"Switch",
"to",
"a",
"different",
"User",
"profile"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/Admin/UserController.php#L75-L82 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/Admin/UserController.php | UserController.edit | public function edit($id)
{
$user = $this->service->find($id);
return view('admin.users.edit')->with('user', $user);
} | php | public function edit($id)
{
$user = $this->service->find($id);
return view('admin.users.edit')->with('user', $user);
} | [
"public",
"function",
"edit",
"(",
"$",
"id",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"service",
"->",
"find",
"(",
"$",
"id",
")",
";",
"return",
"view",
"(",
"'admin.users.edit'",
")",
"->",
"with",
"(",
"'user'",
",",
"$",
"user",
")",
... | Show the form for editing the specified resource.
@param int $id
@return \Illuminate\Http\Response | [
"Show",
"the",
"form",
"for",
"editing",
"the",
"specified",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/Admin/UserController.php#L104-L108 |
GrafiteInc/Builder | src/Packages/Starter/app/Models/User.php | User.hasRole | public function hasRole($role)
{
$roles = array_column($this->roles->toArray(), 'name');
return array_search($role, $roles) > -1;
} | php | public function hasRole($role)
{
$roles = array_column($this->roles->toArray(), 'name');
return array_search($role, $roles) > -1;
} | [
"public",
"function",
"hasRole",
"(",
"$",
"role",
")",
"{",
"$",
"roles",
"=",
"array_column",
"(",
"$",
"this",
"->",
"roles",
"->",
"toArray",
"(",
")",
",",
"'name'",
")",
";",
"return",
"array_search",
"(",
"$",
"role",
",",
"$",
"roles",
")",
... | Check if user has role
@param string $role
@return boolean | [
"Check",
"if",
"user",
"has",
"role"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Models/User.php#L63-L67 |
GrafiteInc/Builder | src/Packages/Starter/app/Models/User.php | User.hasPermission | public function hasPermission($permission)
{
return $this->roles->each(function ($role) use ($permission) {
if (in_array($permission, explode(',', $role->permissions))) {
return true;
}
});
return false;
} | php | public function hasPermission($permission)
{
return $this->roles->each(function ($role) use ($permission) {
if (in_array($permission, explode(',', $role->permissions))) {
return true;
}
});
return false;
} | [
"public",
"function",
"hasPermission",
"(",
"$",
"permission",
")",
"{",
"return",
"$",
"this",
"->",
"roles",
"->",
"each",
"(",
"function",
"(",
"$",
"role",
")",
"use",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"permission",... | Check if user has permission
@param string $permission
@return boolean | [
"Check",
"if",
"user",
"has",
"permission"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Models/User.php#L75-L84 |
GrafiteInc/Builder | src/Packages/Starter/app/Models/User.php | User.isTeamMember | public function isTeamMember($id)
{
$teams = array_column($this->teams->toArray(), 'id');
return array_search($id, $teams) > -1;
} | php | public function isTeamMember($id)
{
$teams = array_column($this->teams->toArray(), 'id');
return array_search($id, $teams) > -1;
} | [
"public",
"function",
"isTeamMember",
"(",
"$",
"id",
")",
"{",
"$",
"teams",
"=",
"array_column",
"(",
"$",
"this",
"->",
"teams",
"->",
"toArray",
"(",
")",
",",
"'id'",
")",
";",
"return",
"array_search",
"(",
"$",
"id",
",",
"$",
"teams",
")",
... | Team member
@return boolean | [
"Team",
"member"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Models/User.php#L101-L105 |
GrafiteInc/Builder | src/Packages/Starter/app/Models/User.php | User.isTeamAdmin | public function isTeamAdmin($id)
{
$team = $this->teams->find($id);
if ($team) {
return (int) $team->user_id === (int) $this->id;
}
return false;
} | php | public function isTeamAdmin($id)
{
$team = $this->teams->find($id);
if ($team) {
return (int) $team->user_id === (int) $this->id;
}
return false;
} | [
"public",
"function",
"isTeamAdmin",
"(",
"$",
"id",
")",
"{",
"$",
"team",
"=",
"$",
"this",
"->",
"teams",
"->",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"team",
")",
"{",
"return",
"(",
"int",
")",
"$",
"team",
"->",
"user_id",
"===... | Team admin
@return boolean | [
"Team",
"admin"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Models/User.php#L112-L121 |
GrafiteInc/Builder | src/Console/Activity.php | Activity.handle | public function handle()
{
if ($this->starterIsInstalled()) {
$fileSystem = new Filesystem();
$files = $fileSystem->allFiles(__DIR__.'/../Packages/Activity');
$this->line("\n");
foreach ($files as $file) {
$this->line(str_replace(__DIR__.'/../... | php | public function handle()
{
if ($this->starterIsInstalled()) {
$fileSystem = new Filesystem();
$files = $fileSystem->allFiles(__DIR__.'/../Packages/Activity');
$this->line("\n");
foreach ($files as $file) {
$this->line(str_replace(__DIR__.'/../... | [
"public",
"function",
"handle",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"starterIsInstalled",
"(",
")",
")",
"{",
"$",
"fileSystem",
"=",
"new",
"Filesystem",
"(",
")",
";",
"$",
"files",
"=",
"$",
"fileSystem",
"->",
"allFiles",
"(",
"__DIR__",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Console/Activity.php#L32-L66 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/User/SettingsController.php | SettingsController.settings | public function settings(Request $request)
{
$user = $request->user();
if ($user) {
return view('user.settings')
->with('user', $user);
}
return back()->withErrors(['Could not find user']);
} | php | public function settings(Request $request)
{
$user = $request->user();
if ($user) {
return view('user.settings')
->with('user', $user);
}
return back()->withErrors(['Could not find user']);
} | [
"public",
"function",
"settings",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
")",
";",
"if",
"(",
"$",
"user",
")",
"{",
"return",
"view",
"(",
"'user.settings'",
")",
"->",
"with",
"(",
"'user'",
... | View current user's settings
@return \Illuminate\Http\Response | [
"View",
"current",
"user",
"s",
"settings"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/User/SettingsController.php#L24-L34 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/User/SettingsController.php | SettingsController.update | public function update(UserUpdateRequest $request)
{
try {
if ($this->service->update(auth()->id(), $request->all())) {
return back()->with('message', 'Settings updated successfully');
}
return back()->withErrors(['Could not update user']);
} catc... | php | public function update(UserUpdateRequest $request)
{
try {
if ($this->service->update(auth()->id(), $request->all())) {
return back()->with('message', 'Settings updated successfully');
}
return back()->withErrors(['Could not update user']);
} catc... | [
"public",
"function",
"update",
"(",
"UserUpdateRequest",
"$",
"request",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"service",
"->",
"update",
"(",
"auth",
"(",
")",
"->",
"id",
"(",
")",
",",
"$",
"request",
"->",
"all",
"(",
")",
")",
... | Update the user
@param UpdateAccountRequest $request
@return \Illuminate\Http\Response | [
"Update",
"the",
"user"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/User/SettingsController.php#L42-L53 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.search | public function search($input)
{
$query = $this->model->orderBy('created_at', 'desc');
$columns = Schema::getColumnListing('users');
foreach ($columns as $attribute) {
$query->orWhere($attribute, 'LIKE', '%'.$input.'%');
};
return $query->paginate(env('PAGINATE... | php | public function search($input)
{
$query = $this->model->orderBy('created_at', 'desc');
$columns = Schema::getColumnListing('users');
foreach ($columns as $attribute) {
$query->orWhere($attribute, 'LIKE', '%'.$input.'%');
};
return $query->paginate(env('PAGINATE... | [
"public",
"function",
"search",
"(",
"$",
"input",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"model",
"->",
"orderBy",
"(",
"'created_at'",
",",
"'desc'",
")",
";",
"$",
"columns",
"=",
"Schema",
"::",
"getColumnListing",
"(",
"'users'",
")",
";"... | Search the users
@param string $input
@return mixed | [
"Search",
"the",
"users"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L88-L99 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.findByRoleID | public function findByRoleID($id)
{
$usersWithRepo = [];
$users = $this->model->all();
foreach ($users as $user) {
if ($user->roles->first()->id == $id) {
$usersWithRepo[] = $user;
}
}
return $usersWithRepo;
} | php | public function findByRoleID($id)
{
$usersWithRepo = [];
$users = $this->model->all();
foreach ($users as $user) {
if ($user->roles->first()->id == $id) {
$usersWithRepo[] = $user;
}
}
return $usersWithRepo;
} | [
"public",
"function",
"findByRoleID",
"(",
"$",
"id",
")",
"{",
"$",
"usersWithRepo",
"=",
"[",
"]",
";",
"$",
"users",
"=",
"$",
"this",
"->",
"model",
"->",
"all",
"(",
")",
";",
"foreach",
"(",
"$",
"users",
"as",
"$",
"user",
")",
"{",
"if",
... | Find by Role ID
@param integer $id
@return Collection | [
"Find",
"by",
"Role",
"ID"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L117-L129 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.findByActivationToken | public function findByActivationToken($token)
{
$userMeta = $this->userMeta->where('activation_token', $token)->first();
if ($userMeta) {
return $userMeta->user()->first();
}
return false;
} | php | public function findByActivationToken($token)
{
$userMeta = $this->userMeta->where('activation_token', $token)->first();
if ($userMeta) {
return $userMeta->user()->first();
}
return false;
} | [
"public",
"function",
"findByActivationToken",
"(",
"$",
"token",
")",
"{",
"$",
"userMeta",
"=",
"$",
"this",
"->",
"userMeta",
"->",
"where",
"(",
"'activation_token'",
",",
"$",
"token",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"userMeta",
... | Find by the user meta activation token
@param string $token
@return boolean | [
"Find",
"by",
"the",
"user",
"meta",
"activation",
"token"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L137-L146 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.create | public function create($user, $password, $role = 'member', $sendEmail = false)
{
try {
DB::transaction(function () use ($user, $password, $role, $sendEmail) {
$this->userMeta->firstOrCreate([
'user_id' => $user->id
]);
$this->a... | php | public function create($user, $password, $role = 'member', $sendEmail = false)
{
try {
DB::transaction(function () use ($user, $password, $role, $sendEmail) {
$this->userMeta->firstOrCreate([
'user_id' => $user->id
]);
$this->a... | [
"public",
"function",
"create",
"(",
"$",
"user",
",",
"$",
"password",
",",
"$",
"role",
"=",
"'member'",
",",
"$",
"sendEmail",
"=",
"false",
")",
"{",
"try",
"{",
"DB",
"::",
"transaction",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"user",
","... | Create a user's profile
@param User $user User
@param string $password the user password
@param string $role the role of this user
@param boolean $sendEmail Whether to send the email or not
@return User | [
"Create",
"a",
"user",
"s",
"profile"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L157-L178 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.update | public function update($userId, $payload)
{
if (isset($payload['meta']) && ! isset($payload['meta']['terms_and_cond'])) {
throw new Exception("You must agree to the terms and conditions.", 1);
}
try {
return DB::transaction(function () use ($userId, $payload) {
... | php | public function update($userId, $payload)
{
if (isset($payload['meta']) && ! isset($payload['meta']['terms_and_cond'])) {
throw new Exception("You must agree to the terms and conditions.", 1);
}
try {
return DB::transaction(function () use ($userId, $payload) {
... | [
"public",
"function",
"update",
"(",
"$",
"userId",
",",
"$",
"payload",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"payload",
"[",
"'meta'",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"payload",
"[",
"'meta'",
"]",
"[",
"'terms_and_cond'",
"]",
")",
")"... | Update a user's profile
@param int $userId User Id
@param array $inputs UserMeta info
@return User | [
"Update",
"a",
"user",
"s",
"profile"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L187-L223 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.invite | public function invite($info)
{
$password = substr(md5(rand(1111, 9999)), 0, 10);
return DB::transaction(function () use ($password, $info) {
$user = $this->model->create([
'email' => $info['email'],
'name' => $info['name'],
'password' => ... | php | public function invite($info)
{
$password = substr(md5(rand(1111, 9999)), 0, 10);
return DB::transaction(function () use ($password, $info) {
$user = $this->model->create([
'email' => $info['email'],
'name' => $info['name'],
'password' => ... | [
"public",
"function",
"invite",
"(",
"$",
"info",
")",
"{",
"$",
"password",
"=",
"substr",
"(",
"md5",
"(",
"rand",
"(",
"1111",
",",
"9999",
")",
")",
",",
"0",
",",
"10",
")",
";",
"return",
"DB",
"::",
"transaction",
"(",
"function",
"(",
")"... | Invite a new member
@param array $info
@return void | [
"Invite",
"a",
"new",
"member"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L230-L243 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.destroy | public function destroy($id)
{
try {
return DB::transaction(function () use ($id) {
$this->unassignAllRoles($id);
$this->leaveAllTeams($id);
$userMetaResult = $this->userMeta->where('user_id', $id)->delete();
$userResult = $this->m... | php | public function destroy($id)
{
try {
return DB::transaction(function () use ($id) {
$this->unassignAllRoles($id);
$this->leaveAllTeams($id);
$userMetaResult = $this->userMeta->where('user_id', $id)->delete();
$userResult = $this->m... | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"try",
"{",
"return",
"DB",
"::",
"transaction",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"unassignAllRoles",
"(",
"$",
"id",
")",
";",
"$",
"this",
... | Destroy the profile
@param int $id
@return bool | [
"Destroy",
"the",
"profile"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L251-L266 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.switchToUser | public function switchToUser($id)
{
try {
$user = $this->model->find($id);
Session::put('original_user', Auth::id());
Auth::login($user);
return true;
} catch (Exception $e) {
throw new Exception("Error logging in as user", 1);
}
... | php | public function switchToUser($id)
{
try {
$user = $this->model->find($id);
Session::put('original_user', Auth::id());
Auth::login($user);
return true;
} catch (Exception $e) {
throw new Exception("Error logging in as user", 1);
}
... | [
"public",
"function",
"switchToUser",
"(",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"(",
"$",
"id",
")",
";",
"Session",
"::",
"put",
"(",
"'original_user'",
",",
"Auth",
"::",
"id",
"(",
")",
"... | Switch user login
@param integer $id
@return boolean | [
"Switch",
"user",
"login"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L274-L284 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.switchUserBack | public function switchUserBack()
{
try {
$original = Session::pull('original_user');
$user = $this->model->find($original);
Auth::login($user);
return true;
} catch (Exception $e) {
throw new Exception("Error returning to your user", 1);
... | php | public function switchUserBack()
{
try {
$original = Session::pull('original_user');
$user = $this->model->find($original);
Auth::login($user);
return true;
} catch (Exception $e) {
throw new Exception("Error returning to your user", 1);
... | [
"public",
"function",
"switchUserBack",
"(",
")",
"{",
"try",
"{",
"$",
"original",
"=",
"Session",
"::",
"pull",
"(",
"'original_user'",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"(",
"$",
"original",
")",
";",
"Auth",
":... | Switch back
@param integer $id
@return boolean | [
"Switch",
"back"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L292-L302 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/UserService.php | UserService.setAndSendUserActivationToken | public function setAndSendUserActivationToken($user)
{
$token = md5(str_random(40));
$user->meta()->update([
'activation_token' => $token
]);
$user->notify(new ActivateUserEmail($token));
} | php | public function setAndSendUserActivationToken($user)
{
$token = md5(str_random(40));
$user->meta()->update([
'activation_token' => $token
]);
$user->notify(new ActivateUserEmail($token));
} | [
"public",
"function",
"setAndSendUserActivationToken",
"(",
"$",
"user",
")",
"{",
"$",
"token",
"=",
"md5",
"(",
"str_random",
"(",
"40",
")",
")",
";",
"$",
"user",
"->",
"meta",
"(",
")",
"->",
"update",
"(",
"[",
"'activation_token'",
"=>",
"$",
"t... | Set and send the user activation token via email
@param void | [
"Set",
"and",
"send",
"the",
"user",
"activation",
"token",
"via",
"email"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/UserService.php#L309-L318 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/Admin/RoleController.php | RoleController.store | public function store(RoleCreateRequest $request)
{
$result = $this->service->create($request->except(['_token', '_method']));
if ($result) {
return redirect('admin/roles')->with('message', 'Successfully created');
}
return back()->with('error', 'Failed to invite');
... | php | public function store(RoleCreateRequest $request)
{
$result = $this->service->create($request->except(['_token', '_method']));
if ($result) {
return redirect('admin/roles')->with('message', 'Successfully created');
}
return back()->with('error', 'Failed to invite');
... | [
"public",
"function",
"store",
"(",
"RoleCreateRequest",
"$",
"request",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"create",
"(",
"$",
"request",
"->",
"except",
"(",
"[",
"'_token'",
",",
"'_method'",
"]",
")",
")",
";",
"if",
... | Show the form for inviting a customer.
@return \Illuminate\Http\Response | [
"Show",
"the",
"form",
"for",
"inviting",
"a",
"customer",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/Admin/RoleController.php#L59-L68 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/Admin/RoleController.php | RoleController.edit | public function edit($id)
{
$role = $this->service->find($id);
return view('admin.roles.edit')->with('role', $role);
} | php | public function edit($id)
{
$role = $this->service->find($id);
return view('admin.roles.edit')->with('role', $role);
} | [
"public",
"function",
"edit",
"(",
"$",
"id",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"service",
"->",
"find",
"(",
"$",
"id",
")",
";",
"return",
"view",
"(",
"'admin.roles.edit'",
")",
"->",
"with",
"(",
"'role'",
",",
"$",
"role",
")",
... | Show the form for editing the specified resource.
@param int $id
@return \Illuminate\Http\Response | [
"Show",
"the",
"form",
"for",
"editing",
"the",
"specified",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/Admin/RoleController.php#L76-L80 |
GrafiteInc/Builder | src/Packages/Billing/app/Http/Controllers/User/BillingController.php | BillingController.getSubscribe | public function getSubscribe(Request $request)
{
$user = $request->user();
$invoice = $user->meta->upcomingInvoice();
if ($user->meta->subscribed(config('plans.subscription_name')) && ! is_null($invoice)) {
return view('billing.details')
->with('invoice', $invoic... | php | public function getSubscribe(Request $request)
{
$user = $request->user();
$invoice = $user->meta->upcomingInvoice();
if ($user->meta->subscribed(config('plans.subscription_name')) && ! is_null($invoice)) {
return view('billing.details')
->with('invoice', $invoic... | [
"public",
"function",
"getSubscribe",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
")",
";",
"$",
"invoice",
"=",
"$",
"user",
"->",
"meta",
"->",
"upcomingInvoice",
"(",
")",
";",
"if",
"(",
"$",
"... | Billing selection
@return \Illuminate\Http\Response | [
"Billing",
"selection"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Http/Controllers/User/BillingController.php#L19-L33 |
GrafiteInc/Builder | src/Packages/Billing/app/Http/Controllers/User/BillingController.php | BillingController.postSubscribe | public function postSubscribe(BillingRequest $request)
{
try {
$payload = $request->all();
$creditCardToken = $payload['stripeToken'];
auth()->user()->meta->newSubscription(config('plans.subscription_name'), config('plans.subscription'))->create($creditCardToken);
... | php | public function postSubscribe(BillingRequest $request)
{
try {
$payload = $request->all();
$creditCardToken = $payload['stripeToken'];
auth()->user()->meta->newSubscription(config('plans.subscription_name'), config('plans.subscription'))->create($creditCardToken);
... | [
"public",
"function",
"postSubscribe",
"(",
"BillingRequest",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"payload",
"=",
"$",
"request",
"->",
"all",
"(",
")",
";",
"$",
"creditCardToken",
"=",
"$",
"payload",
"[",
"'stripeToken'",
"]",
";",
"auth",
"(",... | Create a subscription
@param Request $request
@return \Illuminate\Http\Response | [
"Create",
"a",
"subscription"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Http/Controllers/User/BillingController.php#L41-L54 |
GrafiteInc/Builder | src/Packages/Billing/app/Http/Controllers/User/BillingController.php | BillingController.postChangeCard | public function postChangeCard(BillingRequest $request)
{
try {
$payload = $request->all();
$creditCardToken = $payload['stripeToken'];
auth()->user()->meta->updateCard($creditCardToken);
return redirect('user/billing/details')->with('message', 'Your subscript... | php | public function postChangeCard(BillingRequest $request)
{
try {
$payload = $request->all();
$creditCardToken = $payload['stripeToken'];
auth()->user()->meta->updateCard($creditCardToken);
return redirect('user/billing/details')->with('message', 'Your subscript... | [
"public",
"function",
"postChangeCard",
"(",
"BillingRequest",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"payload",
"=",
"$",
"request",
"->",
"all",
"(",
")",
";",
"$",
"creditCardToken",
"=",
"$",
"payload",
"[",
"'stripeToken'",
"]",
";",
"auth",
"("... | Save new credit card
@param Request $request
@return \Illuminate\Http\Response | [
"Save",
"new",
"credit",
"card"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Http/Controllers/User/BillingController.php#L76-L89 |
GrafiteInc/Builder | src/Packages/Billing/app/Http/Controllers/User/BillingController.php | BillingController.postCoupon | public function postCoupon(BillingRequest $request)
{
try {
$payload = $request->all();
auth()->user()->meta->applyCoupon($payload['coupon']);
return redirect('user/billing/details')->with('message', 'Your coupon was used!');
} catch (Exception $e) {
L... | php | public function postCoupon(BillingRequest $request)
{
try {
$payload = $request->all();
auth()->user()->meta->applyCoupon($payload['coupon']);
return redirect('user/billing/details')->with('message', 'Your coupon was used!');
} catch (Exception $e) {
L... | [
"public",
"function",
"postCoupon",
"(",
"BillingRequest",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"payload",
"=",
"$",
"request",
"->",
"all",
"(",
")",
";",
"auth",
"(",
")",
"->",
"user",
"(",
")",
"->",
"meta",
"->",
"applyCoupon",
"(",
"$",
... | Use a coupon
@param Request $request
@return \Illuminate\Http\Response | [
"Use",
"a",
"coupon"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Http/Controllers/User/BillingController.php#L111-L123 |
GrafiteInc/Builder | src/Packages/Billing/app/Http/Controllers/User/BillingController.php | BillingController.getInvoices | public function getInvoices(Request $request)
{
$user = $request->user();
$invoices = $user->meta->invoices(config('plans.subscription_name'));
return view('billing.invoices')
->with('invoices', $invoices)
->with('user', $user);
} | php | public function getInvoices(Request $request)
{
$user = $request->user();
$invoices = $user->meta->invoices(config('plans.subscription_name'));
return view('billing.invoices')
->with('invoices', $invoices)
->with('user', $user);
} | [
"public",
"function",
"getInvoices",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
")",
";",
"$",
"invoices",
"=",
"$",
"user",
"->",
"meta",
"->",
"invoices",
"(",
"config",
"(",
"'plans.subscription_name... | Get invoices
@param Request $request
@return \Illuminate\Http\Response | [
"Get",
"invoices"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Http/Controllers/User/BillingController.php#L131-L139 |
GrafiteInc/Builder | src/Packages/Billing/app/Http/Controllers/User/BillingController.php | BillingController.getInvoiceById | public function getInvoiceById($id, Request $request)
{
try {
$user = $request->user();
$response = $user->meta->downloadInvoice($id, [
'vendor' => config("invoice.company"),
'street' => config("invoice.street"),
'location' => co... | php | public function getInvoiceById($id, Request $request)
{
try {
$user = $request->user();
$response = $user->meta->downloadInvoice($id, [
'vendor' => config("invoice.company"),
'street' => config("invoice.street"),
'location' => co... | [
"public",
"function",
"getInvoiceById",
"(",
"$",
"id",
",",
"Request",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
")",
";",
"$",
"response",
"=",
"$",
"user",
"->",
"meta",
"->",
"downloadInvoice",
"("... | Get one invoice
@param Request $request
@return \Illuminate\Http\Response | [
"Get",
"one",
"invoice"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Http/Controllers/User/BillingController.php#L147-L165 |
GrafiteInc/Builder | src/Packages/Billing/app/Http/Controllers/User/BillingController.php | BillingController.cancelSubscription | public function cancelSubscription(Request $request)
{
try {
$user = $request->user();
$invoice = $user->meta->upcomingInvoice();
$date = Carbon::createFromTimestamp($invoice->date);
$user->meta->subscription(config('plans.subscription_name'))->cancel();
... | php | public function cancelSubscription(Request $request)
{
try {
$user = $request->user();
$invoice = $user->meta->upcomingInvoice();
$date = Carbon::createFromTimestamp($invoice->date);
$user->meta->subscription(config('plans.subscription_name'))->cancel();
... | [
"public",
"function",
"cancelSubscription",
"(",
"Request",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
")",
";",
"$",
"invoice",
"=",
"$",
"user",
"->",
"meta",
"->",
"upcomingInvoice",
"(",
")",
";",
"... | Cancel Subscription
@param Request $request
@return \Illuminate\Http\Response | [
"Cancel",
"Subscription"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Billing/app/Http/Controllers/User/BillingController.php#L173-L187 |
GrafiteInc/Builder | src/Packages/API/app/Http/Controllers/Api/UserController.php | UserController.getAuthenticatedUser | public function getAuthenticatedUser()
{
try {
if (! $user = JWTAuth::parseToken()->authenticate()) {
return response()->json(['user_not_found'], 404);
}
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
return response()->json(['token... | php | public function getAuthenticatedUser()
{
try {
if (! $user = JWTAuth::parseToken()->authenticate()) {
return response()->json(['user_not_found'], 404);
}
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
return response()->json(['token... | [
"public",
"function",
"getAuthenticatedUser",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"$",
"user",
"=",
"JWTAuth",
"::",
"parseToken",
"(",
")",
"->",
"authenticate",
"(",
")",
")",
"{",
"return",
"response",
"(",
")",
"->",
"json",
"(",
"[",
"'us... | Get the user
@return \Illuminate\Http\Response | [
"Get",
"the",
"user"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/API/app/Http/Controllers/Api/UserController.php#L25-L40 |
GrafiteInc/Builder | src/Packages/API/app/Http/Controllers/Api/UserController.php | UserController.postProfile | public function postProfile(Request $request)
{
$user = $this->getAuthenticatedUser();
if ($this->service->update($user->id, $request->all())) {
return response()->json(compact('user'));
}
return response()->json(['error' => 'Could not update user']);
} | php | public function postProfile(Request $request)
{
$user = $this->getAuthenticatedUser();
if ($this->service->update($user->id, $request->all())) {
return response()->json(compact('user'));
}
return response()->json(['error' => 'Could not update user']);
} | [
"public",
"function",
"postProfile",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getAuthenticatedUser",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"service",
"->",
"update",
"(",
"$",
"user",
"->",
"id",
",",
"$"... | Update the user
@param UpdateAccountRequest $request
@return \Illuminate\Http\Response | [
"Update",
"the",
"user"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/API/app/Http/Controllers/Api/UserController.php#L58-L67 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Controllers/Auth/ActivateController.php | ActivateController.activate | public function activate($token)
{
if ($this->service->activateUser($token)) {
return redirect('dashboard')->with('message', 'Your account was activated');
}
return view('auth.activate.email')->withErrors(['Could not validate your token']);
} | php | public function activate($token)
{
if ($this->service->activateUser($token)) {
return redirect('dashboard')->with('message', 'Your account was activated');
}
return view('auth.activate.email')->withErrors(['Could not validate your token']);
} | [
"public",
"function",
"activate",
"(",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"service",
"->",
"activateUser",
"(",
"$",
"token",
")",
")",
"{",
"return",
"redirect",
"(",
"'dashboard'",
")",
"->",
"with",
"(",
"'message'",
",",
"'Your a... | Activate a user account
@return User | [
"Activate",
"a",
"user",
"account"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Controllers/Auth/ActivateController.php#L47-L54 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/Traits/HasRoles.php | HasRoles.assignRole | public function assignRole($roleName, $userId)
{
$role = $this->role->findByName($roleName);
$user = $this->model->find($userId);
$user->roles()->attach($role);
} | php | public function assignRole($roleName, $userId)
{
$role = $this->role->findByName($roleName);
$user = $this->model->find($userId);
$user->roles()->attach($role);
} | [
"public",
"function",
"assignRole",
"(",
"$",
"roleName",
",",
"$",
"userId",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"role",
"->",
"findByName",
"(",
"$",
"roleName",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"("... | Assign a role to the user
@param string $roleName
@param integer $userId
@return void | [
"Assign",
"a",
"role",
"to",
"the",
"user"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/Traits/HasRoles.php#L14-L20 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/Traits/HasRoles.php | HasRoles.unassignRole | public function unassignRole($roleName, $userId)
{
$role = $this->role->findByName($roleName);
$user = $this->model->find($userId);
$user->roles()->detach($role);
} | php | public function unassignRole($roleName, $userId)
{
$role = $this->role->findByName($roleName);
$user = $this->model->find($userId);
$user->roles()->detach($role);
} | [
"public",
"function",
"unassignRole",
"(",
"$",
"roleName",
",",
"$",
"userId",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"role",
"->",
"findByName",
"(",
"$",
"roleName",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"... | Unassign a role from the user
@param string $roleName
@param integer $userId
@return void | [
"Unassign",
"a",
"role",
"from",
"the",
"user"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/Traits/HasRoles.php#L29-L35 |
GrafiteInc/Builder | src/Packages/Starter/app/Services/Traits/HasRoles.php | HasRoles.unassignAllRoles | public function unassignAllRoles($userId)
{
$user = $this->model->find($userId);
$user->roles()->detach();
} | php | public function unassignAllRoles($userId)
{
$user = $this->model->find($userId);
$user->roles()->detach();
} | [
"public",
"function",
"unassignAllRoles",
"(",
"$",
"userId",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"(",
"$",
"userId",
")",
";",
"$",
"user",
"->",
"roles",
"(",
")",
"->",
"detach",
"(",
")",
";",
"}"
] | Unassign all roles from the user
@param string $roleName
@param integer $userId
@return void | [
"Unassign",
"all",
"roles",
"from",
"the",
"user"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Services/Traits/HasRoles.php#L44-L48 |
GrafiteInc/Builder | src/Packages/API/app/Http/Controllers/Api/AuthController.php | AuthController.login | public function login(Request $request)
{
$credentials = $request->only('email', 'password');
try {
if (! $token = JWTAuth::attempt($credentials)) {
return response()->json(['error' => 'invalid_credentials'], 401);
}
} catch (JWTException $e) {
... | php | public function login(Request $request)
{
$credentials = $request->only('email', 'password');
try {
if (! $token = JWTAuth::attempt($credentials)) {
return response()->json(['error' => 'invalid_credentials'], 401);
}
} catch (JWTException $e) {
... | [
"public",
"function",
"login",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"credentials",
"=",
"$",
"request",
"->",
"only",
"(",
"'email'",
",",
"'password'",
")",
";",
"try",
"{",
"if",
"(",
"!",
"$",
"token",
"=",
"JWTAuth",
"::",
"attempt",
"(... | Login a user
@param Request $request
@return JSON | [
"Login",
"a",
"user"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/API/app/Http/Controllers/Api/AuthController.php#L31-L44 |
GrafiteInc/Builder | src/Packages/API/app/Http/Controllers/Api/AuthController.php | AuthController.register | public function register(Request $request)
{
$data = $request->only('email', 'password');
return DB::transaction(function() use ($data) {
$user = User::create([
'name' => $data['email'],
'email' => $data['email'],
'password' => bcrypt($dat... | php | public function register(Request $request)
{
$data = $request->only('email', 'password');
return DB::transaction(function() use ($data) {
$user = User::create([
'name' => $data['email'],
'email' => $data['email'],
'password' => bcrypt($dat... | [
"public",
"function",
"register",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"data",
"=",
"$",
"request",
"->",
"only",
"(",
"'email'",
",",
"'password'",
")",
";",
"return",
"DB",
"::",
"transaction",
"(",
"function",
"(",
")",
"use",
"(",
"$",
... | Register a User
@param Request $request
@return JSON | [
"Register",
"a",
"User"
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/API/app/Http/Controllers/Api/AuthController.php#L63-L79 |
GrafiteInc/Builder | src/Packages/Logs/app/Http/Controllers/Admin/LogsController.php | LogsController.index | public function index(Request $request)
{
$logs = $this->service->get($request->all());
$levels = $this->service->levels;
$dates = $this->service->getLogDates();
return view('admin.logs.index')
->with('dates', $dates)
->with('logs', $logs)
->with(... | php | public function index(Request $request)
{
$logs = $this->service->get($request->all());
$levels = $this->service->levels;
$dates = $this->service->getLogDates();
return view('admin.logs.index')
->with('dates', $dates)
->with('logs', $logs)
->with(... | [
"public",
"function",
"index",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"logs",
"=",
"$",
"this",
"->",
"service",
"->",
"get",
"(",
"$",
"request",
"->",
"all",
"(",
")",
")",
";",
"$",
"levels",
"=",
"$",
"this",
"->",
"service",
"->",
"l... | Display a listing of the logs.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"logs",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Logs/app/Http/Controllers/Admin/LogsController.php#L21-L31 |
GrafiteInc/Builder | src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php | FeatureController.index | public function index(Request $request)
{
$features = $this->service->paginated();
return view('admin.features.index')->with('features', $features);
} | php | public function index(Request $request)
{
$features = $this->service->paginated();
return view('admin.features.index')->with('features', $features);
} | [
"public",
"function",
"index",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"features",
"=",
"$",
"this",
"->",
"service",
"->",
"paginated",
"(",
")",
";",
"return",
"view",
"(",
"'admin.features.index'",
")",
"->",
"with",
"(",
"'features'",
",",
"$"... | Display a listing of the resource.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php#L23-L27 |
GrafiteInc/Builder | src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php | FeatureController.search | public function search(Request $request)
{
$features = $this->service->search($request->search, null);
return view('admin.features.index')->with('features', $features);
} | php | public function search(Request $request)
{
$features = $this->service->search($request->search, null);
return view('admin.features.index')->with('features', $features);
} | [
"public",
"function",
"search",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"features",
"=",
"$",
"this",
"->",
"service",
"->",
"search",
"(",
"$",
"request",
"->",
"search",
",",
"null",
")",
";",
"return",
"view",
"(",
"'admin.features.index'",
")"... | Display a listing of the resource searched.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource",
"searched",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php#L34-L38 |
GrafiteInc/Builder | src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php | FeatureController.store | public function store(FeatureCreateRequest $request)
{
$result = $this->service->create($request->except('_token'));
if ($result && is_object($result)) {
return redirect('admin/features/'.$result->id.'/edit')->with('message', 'Successfully created');
} elseif ($result) {
... | php | public function store(FeatureCreateRequest $request)
{
$result = $this->service->create($request->except('_token'));
if ($result && is_object($result)) {
return redirect('admin/features/'.$result->id.'/edit')->with('message', 'Successfully created');
} elseif ($result) {
... | [
"public",
"function",
"store",
"(",
"FeatureCreateRequest",
"$",
"request",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"create",
"(",
"$",
"request",
"->",
"except",
"(",
"'_token'",
")",
")",
";",
"if",
"(",
"$",
"result",
"&&",... | Store a newly created resource in storage.
@param \Illuminate\Http\FeatureCreateRequest $request
@return \Illuminate\Http\Response | [
"Store",
"a",
"newly",
"created",
"resource",
"in",
"storage",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php#L56-L67 |
GrafiteInc/Builder | src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php | FeatureController.edit | public function edit($id)
{
$feature = $this->service->find($id);
return view('admin.features.edit')->with('feature', $feature);
} | php | public function edit($id)
{
$feature = $this->service->find($id);
return view('admin.features.edit')->with('feature', $feature);
} | [
"public",
"function",
"edit",
"(",
"$",
"id",
")",
"{",
"$",
"feature",
"=",
"$",
"this",
"->",
"service",
"->",
"find",
"(",
"$",
"id",
")",
";",
"return",
"view",
"(",
"'admin.features.edit'",
")",
"->",
"with",
"(",
"'feature'",
",",
"$",
"feature... | Show the form for editing the specified resource.
@param int $id
@return \Illuminate\Http\Response | [
"Show",
"the",
"form",
"for",
"editing",
"the",
"specified",
"resource",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php#L75-L79 |
GrafiteInc/Builder | src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php | FeatureController.destroy | public function destroy($id)
{
$result = $this->service->destroy($id);
if ($result) {
return redirect('admin/features')->with('message', 'Successfully deleted');
}
return redirect('admin/features')->with('errors', ['Failed to delete']);
} | php | public function destroy($id)
{
$result = $this->service->destroy($id);
if ($result) {
return redirect('admin/features')->with('message', 'Successfully deleted');
}
return redirect('admin/features')->with('errors', ['Failed to delete']);
} | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"service",
"->",
"destroy",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"result",
")",
"{",
"return",
"redirect",
"(",
"'admin/features'",
")",
"->",
"w... | Remove the specified resource from storage.
@param int $id
@return \Illuminate\Http\Response | [
"Remove",
"the",
"specified",
"resource",
"from",
"storage",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Features/app/Http/Controllers/Admin/FeatureController.php#L105-L114 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Middleware/Active.php | Active.handle | public function handle($request, Closure $next)
{
if (! $this->auth->user()->meta->is_active) {
return redirect()->guest('activate');
}
return $next($request);
} | php | public function handle($request, Closure $next)
{
if (! $this->auth->user()->meta->is_active) {
return redirect()->guest('activate');
}
return $next($request);
} | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"auth",
"->",
"user",
"(",
")",
"->",
"meta",
"->",
"is_active",
")",
"{",
"return",
"redirect",
"(",
")",
"->",
"guest",... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Middleware/Active.php#L35-L42 |
GrafiteInc/Builder | src/Packages/Starter/app/Notifications/ActivateUserEmail.php | ActivateUserEmail.toMail | public function toMail($notifiable)
{
return (new MailMessage)
->greeting('Hey '.$notifiable->name)
->line('You have a brand new account on '.url('/'))
->line('But, you are receiving this email because we need you to activate your account.')
->action('Activate... | php | public function toMail($notifiable)
{
return (new MailMessage)
->greeting('Hey '.$notifiable->name)
->line('You have a brand new account on '.url('/'))
->line('But, you are receiving this email because we need you to activate your account.')
->action('Activate... | [
"public",
"function",
"toMail",
"(",
"$",
"notifiable",
")",
"{",
"return",
"(",
"new",
"MailMessage",
")",
"->",
"greeting",
"(",
"'Hey '",
".",
"$",
"notifiable",
"->",
"name",
")",
"->",
"line",
"(",
"'You have a brand new account on '",
".",
"url",
"(",
... | Build the mail representation of the notification.
@param mixed $notifiable
@return \Illuminate\Notifications\Messages\MailMessage | [
"Build",
"the",
"mail",
"representation",
"of",
"the",
"notification",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Notifications/ActivateUserEmail.php#L47-L54 |
GrafiteInc/Builder | src/Packages/Starter/app/Http/Middleware/Roles.php | Roles.handle | public function handle($request, Closure $next, ... $roles)
{
foreach ($roles as $role) {
if ($request->user()->hasRole($role)) {
return $next($request);
}
}
return response()->view('errors.401', [], 401);
} | php | public function handle($request, Closure $next, ... $roles)
{
foreach ($roles as $role) {
if ($request->user()->hasRole($role)) {
return $next($request);
}
}
return response()->view('errors.401', [], 401);
} | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
",",
"...",
"$",
"roles",
")",
"{",
"foreach",
"(",
"$",
"roles",
"as",
"$",
"role",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"user",
"(",
")",
"->",
"hasRole",
"... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/GrafiteInc/Builder/blob/d67ae09e693580354eb4c143fe7a201656557cc3/src/Packages/Starter/app/Http/Middleware/Roles.php#L18-L27 |
spatie/laravel-fractal | src/FractalServiceProvider.php | FractalServiceProvider.boot | public function boot()
{
$this->setupConfig();
if ($this->app->runningInConsole()) {
$this->commands([
TransformerMakeCommand::class,
]);
}
$this->setupMacro();
} | php | public function boot()
{
$this->setupConfig();
if ($this->app->runningInConsole()) {
$this->commands([
TransformerMakeCommand::class,
]);
}
$this->setupMacro();
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"setupConfig",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"runningInConsole",
"(",
")",
")",
"{",
"$",
"this",
"->",
"commands",
"(",
"[",
"TransformerMakeCommand",
"::",
... | Bootstrap the application services. | [
"Bootstrap",
"the",
"application",
"services",
"."
] | train | https://github.com/spatie/laravel-fractal/blob/772de030cae20bc2fa5ec00773bb93c8f2663811/src/FractalServiceProvider.php#L16-L27 |
spatie/laravel-fractal | src/FractalServiceProvider.php | FractalServiceProvider.register | public function register()
{
$this->app->singleton('fractal', function ($app, $arguments) {
return fractal(...$arguments);
});
$this->app->alias('fractal', Fractal::class);
} | php | public function register()
{
$this->app->singleton('fractal', function ($app, $arguments) {
return fractal(...$arguments);
});
$this->app->alias('fractal', Fractal::class);
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'fractal'",
",",
"function",
"(",
"$",
"app",
",",
"$",
"arguments",
")",
"{",
"return",
"fractal",
"(",
"...",
"$",
"arguments",
")",
";",
"}",
")",
... | Register the application services. | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/spatie/laravel-fractal/blob/772de030cae20bc2fa5ec00773bb93c8f2663811/src/FractalServiceProvider.php#L32-L39 |
spatie/laravel-fractal | src/Fractal.php | Fractal.create | public static function create($data = null, $transformer = null, $serializer = null)
{
$fractal = parent::create($data, $transformer, $serializer);
if (config('fractal.auto_includes.enabled')) {
$requestKey = config('fractal.auto_includes.request_key');
if ($include = app('... | php | public static function create($data = null, $transformer = null, $serializer = null)
{
$fractal = parent::create($data, $transformer, $serializer);
if (config('fractal.auto_includes.enabled')) {
$requestKey = config('fractal.auto_includes.request_key');
if ($include = app('... | [
"public",
"static",
"function",
"create",
"(",
"$",
"data",
"=",
"null",
",",
"$",
"transformer",
"=",
"null",
",",
"$",
"serializer",
"=",
"null",
")",
"{",
"$",
"fractal",
"=",
"parent",
"::",
"create",
"(",
"$",
"data",
",",
"$",
"transformer",
",... | @param null|mixed $data
@param null|callable|\League\Fractal\TransformerAbstract $transformer
@param null|\League\Fractal\Serializer\SerializerAbstract $serializer
@return \Spatie\Fractalistic\Fractal | [
"@param",
"null|mixed",
"$data",
"@param",
"null|callable|",
"\\",
"League",
"\\",
"Fractal",
"\\",
"TransformerAbstract",
"$transformer",
"@param",
"null|",
"\\",
"League",
"\\",
"Fractal",
"\\",
"Serializer",
"\\",
"SerializerAbstract",
"$serializer"
] | train | https://github.com/spatie/laravel-fractal/blob/772de030cae20bc2fa5ec00773bb93c8f2663811/src/Fractal.php#L35-L80 |
spatie/laravel-fractal | src/Fractal.php | Fractal.respond | public function respond($statusCode = 200, $headers = [], $options = 0)
{
$response = new JsonResponse();
$response->setData($this->createData()->toArray());
if (is_int($statusCode)) {
$statusCode = function (JsonResponse $response) use ($statusCode) {
return $r... | php | public function respond($statusCode = 200, $headers = [], $options = 0)
{
$response = new JsonResponse();
$response->setData($this->createData()->toArray());
if (is_int($statusCode)) {
$statusCode = function (JsonResponse $response) use ($statusCode) {
return $r... | [
"public",
"function",
"respond",
"(",
"$",
"statusCode",
"=",
"200",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"0",
")",
"{",
"$",
"response",
"=",
"new",
"JsonResponse",
"(",
")",
";",
"$",
"response",
"->",
"setData",
"(",
"$"... | Return a new JSON response.
@param callable|int $statusCode
@param callable|array $headers
@param callable|int $options
@return \Illuminate\Http\JsonResponse | [
"Return",
"a",
"new",
"JSON",
"response",
"."
] | train | https://github.com/spatie/laravel-fractal/blob/772de030cae20bc2fa5ec00773bb93c8f2663811/src/Fractal.php#L91-L130 |
php-http/HttplugBundle | src/Collector/ProfilePlugin.php | ProfilePlugin.collectRequestInformation | private function collectRequestInformation(RequestInterface $request, Stack $stack = null)
{
if (empty($stack->getRequestTarget())) {
$stack->setRequestTarget($request->getRequestTarget());
}
if (empty($stack->getRequestMethod())) {
$stack->setRequestMethod($request->... | php | private function collectRequestInformation(RequestInterface $request, Stack $stack = null)
{
if (empty($stack->getRequestTarget())) {
$stack->setRequestTarget($request->getRequestTarget());
}
if (empty($stack->getRequestMethod())) {
$stack->setRequestMethod($request->... | [
"private",
"function",
"collectRequestInformation",
"(",
"RequestInterface",
"$",
"request",
",",
"Stack",
"$",
"stack",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"stack",
"->",
"getRequestTarget",
"(",
")",
")",
")",
"{",
"$",
"stack",
"->",
... | Collect request information when not already done by the HTTP client. This happens when using the CachePlugin
and the cache is hit without re-validation.
@param RequestInterface $request
@param Stack|null $stack | [
"Collect",
"request",
"information",
"when",
"not",
"already",
"done",
"by",
"the",
"HTTP",
"client",
".",
"This",
"happens",
"when",
"using",
"the",
"CachePlugin",
"and",
"the",
"cache",
"is",
"hit",
"without",
"re",
"-",
"validation",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/ProfilePlugin.php#L134-L154 |
php-http/HttplugBundle | src/Collector/Collector.php | Collector.activateStack | public function activateStack(Stack $stack)
{
if (null !== $this->activeStack) {
$stack->setParent($this->activeStack);
}
$this->activeStack = $stack;
} | php | public function activateStack(Stack $stack)
{
if (null !== $this->activeStack) {
$stack->setParent($this->activeStack);
}
$this->activeStack = $stack;
} | [
"public",
"function",
"activateStack",
"(",
"Stack",
"$",
"stack",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"activeStack",
")",
"{",
"$",
"stack",
"->",
"setParent",
"(",
"$",
"this",
"->",
"activeStack",
")",
";",
"}",
"$",
"this",
"->... | Mark the stack as active. If a stack was already active, use it as parent for our stack.
@param Stack $stack | [
"Mark",
"the",
"stack",
"as",
"active",
".",
"If",
"a",
"stack",
"was",
"already",
"active",
"use",
"it",
"as",
"parent",
"for",
"our",
"stack",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/Collector.php#L63-L70 |
php-http/HttplugBundle | src/Collector/Collector.php | Collector.getChildrenStacks | public function getChildrenStacks(Stack $parent)
{
return array_filter($this->data['stacks'], function (Stack $stack) use ($parent) {
return $stack->getParent() === $parent;
});
} | php | public function getChildrenStacks(Stack $parent)
{
return array_filter($this->data['stacks'], function (Stack $stack) use ($parent) {
return $stack->getParent() === $parent;
});
} | [
"public",
"function",
"getChildrenStacks",
"(",
"Stack",
"$",
"parent",
")",
"{",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"data",
"[",
"'stacks'",
"]",
",",
"function",
"(",
"Stack",
"$",
"stack",
")",
"use",
"(",
"$",
"parent",
")",
"{",
"re... | @param Stack $parent
@return Stack[] | [
"@param",
"Stack",
"$parent"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/Collector.php#L103-L108 |
php-http/HttplugBundle | src/Collector/Collector.php | Collector.getClientRootStacks | public function getClientRootStacks($client)
{
return array_filter($this->data['stacks'], function (Stack $stack) use ($client) {
return $stack->getClient() == $client && null == $stack->getParent();
});
} | php | public function getClientRootStacks($client)
{
return array_filter($this->data['stacks'], function (Stack $stack) use ($client) {
return $stack->getClient() == $client && null == $stack->getParent();
});
} | [
"public",
"function",
"getClientRootStacks",
"(",
"$",
"client",
")",
"{",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"data",
"[",
"'stacks'",
"]",
",",
"function",
"(",
"Stack",
"$",
"stack",
")",
"use",
"(",
"$",
"client",
")",
"{",
"return",
... | @param $client
@return Stack[] | [
"@param",
"$client"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/Collector.php#L157-L162 |
php-http/HttplugBundle | src/Collector/Collector.php | Collector.countClientMessages | public function countClientMessages($client)
{
return array_sum(array_map(function (Stack $stack) {
return $this->countStackMessages($stack);
}, $this->getClientRootStacks($client)));
} | php | public function countClientMessages($client)
{
return array_sum(array_map(function (Stack $stack) {
return $this->countStackMessages($stack);
}, $this->getClientRootStacks($client)));
} | [
"public",
"function",
"countClientMessages",
"(",
"$",
"client",
")",
"{",
"return",
"array_sum",
"(",
"array_map",
"(",
"function",
"(",
"Stack",
"$",
"stack",
")",
"{",
"return",
"$",
"this",
"->",
"countStackMessages",
"(",
"$",
"stack",
")",
";",
"}",
... | Count all messages for a client.
@param $client
@return int | [
"Count",
"all",
"messages",
"for",
"a",
"client",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/Collector.php#L171-L176 |
php-http/HttplugBundle | src/Collector/Collector.php | Collector.countStackMessages | private function countStackMessages(Stack $stack)
{
return 1 + array_sum(array_map(function (Stack $child) {
return $this->countStackMessages($child);
}, $this->getChildrenStacks($stack)));
} | php | private function countStackMessages(Stack $stack)
{
return 1 + array_sum(array_map(function (Stack $child) {
return $this->countStackMessages($child);
}, $this->getChildrenStacks($stack)));
} | [
"private",
"function",
"countStackMessages",
"(",
"Stack",
"$",
"stack",
")",
"{",
"return",
"1",
"+",
"array_sum",
"(",
"array_map",
"(",
"function",
"(",
"Stack",
"$",
"child",
")",
"{",
"return",
"$",
"this",
"->",
"countStackMessages",
"(",
"$",
"child... | Recursively count message in stack.
@param Stack $stack
@return int | [
"Recursively",
"count",
"message",
"in",
"stack",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/Collector.php#L185-L190 |
php-http/HttplugBundle | src/DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('httplug');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->root('httplug');
} else {
$rootNode = $treeBuilder-... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('httplug');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->root('httplug');
} else {
$rootNode = $treeBuilder-... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"'httplug'",
")",
";",
"// Keep compatibility with symfony/config < 4.2",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"treeBuilder",
",",
"'getRootNode'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/Configuration.php#L51-L176 |
php-http/HttplugBundle | src/DependencyInjection/Configuration.php | Configuration.createClientPluginNode | private function createClientPluginNode()
{
$treeBuilder = new TreeBuilder('plugins');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$node = $treeBuilder->root('plugins');
} else {
$node = $treeBuilder->getR... | php | private function createClientPluginNode()
{
$treeBuilder = new TreeBuilder('plugins');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$node = $treeBuilder->root('plugins');
} else {
$node = $treeBuilder->getR... | [
"private",
"function",
"createClientPluginNode",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"'plugins'",
")",
";",
"// Keep compatibility with symfony/config < 4.2",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"treeBuilder",
",",
"'getRootNode'"... | Createplugins node of a client.
@return ArrayNodeDefinition The plugin node | [
"Createplugins",
"node",
"of",
"a",
"client",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/Configuration.php#L257-L444 |
php-http/HttplugBundle | src/DependencyInjection/Configuration.php | Configuration.addSharedPluginNodes | private function addSharedPluginNodes(ArrayNodeDefinition $pluginNode, $disableAll = false)
{
$children = $pluginNode->children();
$children->append($this->createAuthenticationPluginNode());
$children->append($this->createCachePluginNode());
$children
->arrayNode('cooki... | php | private function addSharedPluginNodes(ArrayNodeDefinition $pluginNode, $disableAll = false)
{
$children = $pluginNode->children();
$children->append($this->createAuthenticationPluginNode());
$children->append($this->createCachePluginNode());
$children
->arrayNode('cooki... | [
"private",
"function",
"addSharedPluginNodes",
"(",
"ArrayNodeDefinition",
"$",
"pluginNode",
",",
"$",
"disableAll",
"=",
"false",
")",
"{",
"$",
"children",
"=",
"$",
"pluginNode",
"->",
"children",
"(",
")",
";",
"$",
"children",
"->",
"append",
"(",
"$",... | Add the definitions for shared plugin configurations.
@param ArrayNodeDefinition $pluginNode the node to add to
@param bool $disableAll Some shared plugins are enabled by default. On the client, all are disabled by default. | [
"Add",
"the",
"definitions",
"for",
"shared",
"plugin",
"configurations",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/Configuration.php#L452-L542 |
php-http/HttplugBundle | src/DependencyInjection/Configuration.php | Configuration.createAuthenticationPluginNode | private function createAuthenticationPluginNode()
{
$treeBuilder = new TreeBuilder('authentication');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$node = $treeBuilder->root('authentication');
} else {
$nod... | php | private function createAuthenticationPluginNode()
{
$treeBuilder = new TreeBuilder('authentication');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$node = $treeBuilder->root('authentication');
} else {
$nod... | [
"private",
"function",
"createAuthenticationPluginNode",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"'authentication'",
")",
";",
"// Keep compatibility with symfony/config < 4.2",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"treeBuilder",
",",
... | Create configuration for authentication plugin.
@return NodeDefinition definition for the authentication node in the plugins list | [
"Create",
"configuration",
"for",
"authentication",
"plugin",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/Configuration.php#L549-L607 |
php-http/HttplugBundle | src/DependencyInjection/Configuration.php | Configuration.validateAuthenticationType | private function validateAuthenticationType(array $expected, array $actual, $authName)
{
unset($actual['type']);
// Empty array is always provided, even if the config is not filled.
if (empty($actual['params'])) {
unset($actual['params']);
}
$actual = array_keys($... | php | private function validateAuthenticationType(array $expected, array $actual, $authName)
{
unset($actual['type']);
// Empty array is always provided, even if the config is not filled.
if (empty($actual['params'])) {
unset($actual['params']);
}
$actual = array_keys($... | [
"private",
"function",
"validateAuthenticationType",
"(",
"array",
"$",
"expected",
",",
"array",
"$",
"actual",
",",
"$",
"authName",
")",
"{",
"unset",
"(",
"$",
"actual",
"[",
"'type'",
"]",
")",
";",
"// Empty array is always provided, even if the config is not ... | Validate that the configuration fragment has the specified keys and none other.
@param array $expected Fields that must exist
@param array $actual Actual configuration hashmap
@param string $authName Name of authentication method for error messages
@throws InvalidConfigurationException If $actual does not have ex... | [
"Validate",
"that",
"the",
"configuration",
"fragment",
"has",
"the",
"specified",
"keys",
"and",
"none",
"other",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/Configuration.php#L618-L639 |
php-http/HttplugBundle | src/DependencyInjection/Configuration.php | Configuration.createCachePluginNode | private function createCachePluginNode()
{
$builder = new TreeBuilder('config');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($builder, 'getRootNode')) {
$config = $builder->root('config');
} else {
$config = $builder->getRootNode();
... | php | private function createCachePluginNode()
{
$builder = new TreeBuilder('config');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($builder, 'getRootNode')) {
$config = $builder->root('config');
} else {
$config = $builder->getRootNode();
... | [
"private",
"function",
"createCachePluginNode",
"(",
")",
"{",
"$",
"builder",
"=",
"new",
"TreeBuilder",
"(",
"'config'",
")",
";",
"// Keep compatibility with symfony/config < 4.2",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"builder",
",",
"'getRootNode'",
")",
... | Create configuration for cache plugin.
@return NodeDefinition definition for the cache node in the plugins list | [
"Create",
"configuration",
"for",
"cache",
"plugin",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/Configuration.php#L646-L751 |
php-http/HttplugBundle | src/Discovery/ConfiguredClientsStrategy.php | ConfiguredClientsStrategy.getCandidates | public static function getCandidates($type)
{
if (HttpClient::class === $type && null !== self::$client) {
return [['class' => function () {
return self::$client;
}]];
}
if (HttpAsyncClient::class === $type && null !== self::$asyncClient) {
... | php | public static function getCandidates($type)
{
if (HttpClient::class === $type && null !== self::$client) {
return [['class' => function () {
return self::$client;
}]];
}
if (HttpAsyncClient::class === $type && null !== self::$asyncClient) {
... | [
"public",
"static",
"function",
"getCandidates",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"HttpClient",
"::",
"class",
"===",
"$",
"type",
"&&",
"null",
"!==",
"self",
"::",
"$",
"client",
")",
"{",
"return",
"[",
"[",
"'class'",
"=>",
"function",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Discovery/ConfiguredClientsStrategy.php#L44-L59 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.