code
stringlengths 17
296k
| docstring
stringlengths 30
30.3k
| func_name
stringlengths 1
89
| language
stringclasses 1
value | repo
stringlengths 7
63
| path
stringlengths 7
153
| url
stringlengths 51
209
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
protected function assert_post_conditions() {
++self::$postConditions;
} | This method is called before the execution of a test ends and before tear_down() is called.
@return void | assert_post_conditions | php | Yoast/PHPUnit-Polyfills | tests/TestCases/TestCaseTest.php | https://github.com/Yoast/PHPUnit-Polyfills/blob/master/tests/TestCases/TestCaseTest.php | BSD-3-Clause |
protected function tear_down() {
++self::$after;
} | This method is called after each test.
@return void | tear_down | php | Yoast/PHPUnit-Polyfills | tests/TestCases/TestCaseTest.php | https://github.com/Yoast/PHPUnit-Polyfills/blob/master/tests/TestCases/TestCaseTest.php | BSD-3-Clause |
public static function tear_down_after_class() {
// Reset.
self::$beforeClass = 0;
self::$before = 0;
self::$preConditions = 0;
self::$postConditions = 0;
self::$after = 0;
} | This method is called after the last test of this test class is run.
@return void | tear_down_after_class | php | Yoast/PHPUnit-Polyfills | tests/TestCases/TestCaseTest.php | https://github.com/Yoast/PHPUnit-Polyfills/blob/master/tests/TestCases/TestCaseTest.php | BSD-3-Clause |
public function getRouteKey()
{
$id = parent::getRouteKey();
return $this->getOptimus()->encode($id);
} | Get the value of the model's route key.
@return mixed | getRouteKey | php | cybercog/laravel-optimus | src/Traits/OptimusEncodedRouteKey.php | https://github.com/cybercog/laravel-optimus/blob/master/src/Traits/OptimusEncodedRouteKey.php | MIT |
public function resolveRouteBinding($value, $field = null)
{
if ($field === null) {
$field = $this->getRouteKeyName();
}
if (is_string($value) && ctype_digit($value)) {
$value = (int) $value;
}
if (is_int($value) && $field === $this->getRouteKeyName()) {
$value = $this->getOptimus()->decode($value);
}
return $this->where($field, $value)->first();
} | Retrieve the model for a bound value.
@param mixed $value
@param string|null $field
@return \Illuminate\Database\Eloquent\Model|null | resolveRouteBinding | php | cybercog/laravel-optimus | src/Traits/OptimusEncodedRouteKey.php | https://github.com/cybercog/laravel-optimus/blob/master/src/Traits/OptimusEncodedRouteKey.php | MIT |
public function resolveRouteBindingQuery($query, $value, $field = null)
{
if ($field === null) {
$field = $query->getRouteKeyName();
}
if (is_string($value) && ctype_digit($value)) {
$value = (int) $value;
}
if (is_int($value) && $field === $this->getRouteKeyName()) {
$value = $this->getOptimus()->decode($value);
}
return $query->where($field, $value);
} | Retrieve the model for a bound value.
@param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation $query
@param mixed $value
@param string|null $field
@return \Illuminate\Database\Eloquent\Relations\Relation | resolveRouteBindingQuery | php | cybercog/laravel-optimus | src/Traits/OptimusEncodedRouteKey.php | https://github.com/cybercog/laravel-optimus/blob/master/src/Traits/OptimusEncodedRouteKey.php | MIT |
public function authorize()
{
return $this->user()->can('create', new Category)
&& $this->user()->can('manage-categories', auth()->activeBook());
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | buku-masjid/buku-masjid | app/Http/Requests/Categories/CreateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Categories/CreateRequest.php | MIT |
public function rules()
{
return [
'name' => 'required|max:60',
'color' => 'required|string|max:7',
'description' => 'nullable|string|max:255',
'book_id' => 'required|exists:books,id',
];
} | Get the validation rules that apply to the request.
@return array | rules | php | buku-masjid/buku-masjid | app/Http/Requests/Categories/CreateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Categories/CreateRequest.php | MIT |
public function save()
{
$newCategory = $this->validated();
$newCategory['creator_id'] = $this->user()->id;
return Category::create($newCategory);
} | Save category to the database.
@return \App\Models\Category | save | php | buku-masjid/buku-masjid | app/Http/Requests/Categories/CreateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Categories/CreateRequest.php | MIT |
public function authorize()
{
return $this->user()->can('update', $this->route('category'))
&& $this->user()->can('manage-categories', auth()->activeBook());
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | buku-masjid/buku-masjid | app/Http/Requests/Categories/UpdateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Categories/UpdateRequest.php | MIT |
public function rules()
{
return [
'name' => 'required|max:60',
'color' => 'required|string|max:7',
'description' => 'nullable|string|max:255',
'status_id' => ['required', Rule::in(Category::getConstants('STATUS'))],
'book_id' => 'required|exists:books,id',
'report_visibility_code' => ['required', Rule::in(Category::getConstants('REPORT_VISIBILITY'))],
];
} | Get the validation rules that apply to the request.
@return array | rules | php | buku-masjid/buku-masjid | app/Http/Requests/Categories/UpdateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Categories/UpdateRequest.php | MIT |
public function authorize()
{
return $this->user()->can('delete', $this->route('category'))
&& $this->user()->can('manage-categories', auth()->activeBook());
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | buku-masjid/buku-masjid | app/Http/Requests/Categories/DeleteRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Categories/DeleteRequest.php | MIT |
public function rules()
{
return [
'category_id' => 'required',
'delete_transactions' => 'boolean',
];
} | Get the validation rules that apply to the request.
@return array | rules | php | buku-masjid/buku-masjid | app/Http/Requests/Categories/DeleteRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Categories/DeleteRequest.php | MIT |
public function delete()
{
$category = $this->route('category');
if ($this->has('delete_transactions')) {
$category->transactions()->delete();
} else {
$category->transactions()->update(['category_id' => null]);
}
if ($this->get('category_id') == $category->id) {
return $category->delete();
}
return false;
} | Delete category from database.
@return bool | delete | php | buku-masjid/buku-masjid | app/Http/Requests/Categories/DeleteRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Categories/DeleteRequest.php | MIT |
public function authorize()
{
return $this->user()->can('create', new Transaction)
&& $this->user()->can('manage-transactions', auth()->activeBook());
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | buku-masjid/buku-masjid | app/Http/Requests/Transactions/CreateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Transactions/CreateRequest.php | MIT |
public function rules()
{
return [
'date' => 'required|date|date_format:Y-m-d',
'amount' => 'required|max:60',
'in_out' => 'required|boolean',
'description' => 'required|max:255',
'category_id' => 'nullable|exists:categories,id',
'partner_id' => 'nullable|exists:partners,id',
'book_id' => ['required', 'exists:books,id'],
'bank_account_id' => ['nullable', 'exists:bank_accounts,id'],
'files' => ['nullable', 'array'],
'files.*' => ['file', 'mimes:jpg,bmp,png', 'max:5120'],
];
} | Get the validation rules that apply to the request.
@return array | rules | php | buku-masjid/buku-masjid | app/Http/Requests/Transactions/CreateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Transactions/CreateRequest.php | MIT |
public function authorize()
{
return $this->user()->can('update', $this->route('transaction'))
&& $this->user()->can('manage-transactions', $this->route('transaction')->book);
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | buku-masjid/buku-masjid | app/Http/Requests/Transactions/UpdateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Transactions/UpdateRequest.php | MIT |
public function rules()
{
return [
'in_out' => 'required|boolean',
'date' => 'required|date|date_format:Y-m-d',
'amount' => 'required|max:60',
'description' => 'required|max:255',
'category_id' => 'nullable|exists:categories,id',
'partner_id' => ['nullable', 'exists:partners,id'],
'bank_account_id' => ['nullable', 'exists:bank_accounts,id'],
];
} | Get the validation rules that apply to the request.
@return array | rules | php | buku-masjid/buku-masjid | app/Http/Requests/Transactions/UpdateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Transactions/UpdateRequest.php | MIT |
public function save()
{
$transaction = $this->route('transaction');
$transaction->update($this->validated());
return $transaction;
} | Update transaction in database.
@return \App\Models\Category | save | php | buku-masjid/buku-masjid | app/Http/Requests/Transactions/UpdateRequest.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Requests/Transactions/UpdateRequest.php | MIT |
public function __construct()
{
$this->middleware('guest')->except('logout');
} | Create a new controller instance.
@return void | __construct | php | buku-masjid/buku-masjid | app/Http/Controllers/Auth/LoginController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Auth/LoginController.php | MIT |
protected function authenticated(Request $request, $user)
{
if ($user->is_active == 0) {
$this->guard()->logout();
$request->session()->flush();
$request->session()->regenerate();
flash(trans('auth.user_inactive'), 'error');
return redirect()->route('login');
}
flash(trans('auth.welcome', ['name' => $user->name]));
} | The user has been authenticated.
@param mixed $user
@return mixed | authenticated | php | buku-masjid/buku-masjid | app/Http/Controllers/Auth/LoginController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Auth/LoginController.php | MIT |
public function __construct()
{
$this->middleware('guest');
} | Create a new controller instance.
@return void | __construct | php | buku-masjid/buku-masjid | app/Http/Controllers/Auth/ResetPasswordController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Auth/ResetPasswordController.php | MIT |
public function __construct()
{
$this->middleware('auth');
} | Create a new controller instance.
@return void | __construct | php | buku-masjid/buku-masjid | app/Http/Controllers/Auth/ChangePasswordController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Auth/ChangePasswordController.php | MIT |
public function __construct()
{
$this->middleware('guest');
} | Create a new controller instance.
@return void | __construct | php | buku-masjid/buku-masjid | app/Http/Controllers/Auth/ForgotPasswordController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Auth/ForgotPasswordController.php | MIT |
public function index()
{
$yearMonth = $this->getYearMonth();
return new TransactionCollection(
$this->getTansactions($yearMonth)
);
} | Return a listing of the transaction.
@return \App\Http\Resources\TransactionCollection | index | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/TransactionsController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/TransactionsController.php | MIT |
public function store(CreateRequest $transactionCreateForm)
{
$transaction = $transactionCreateForm->save();
$responseMessage = __('transaction.income_added');
if ($transaction['in_out'] == 0) {
$responseMessage = __('transaction.spending_added');
}
$responseData = [
'message' => $responseMessage,
'data' => new TransactionResource($transaction),
];
return response()->json($responseData, 201);
} | Store a newly created transaction in storage.
@return \Illuminate\Http\JsonResponse | store | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/TransactionsController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/TransactionsController.php | MIT |
public function show(Transaction $transaction)
{
return new TransactionResource($transaction);
} | Show the specified transaction data.
@return \App\Http\Controllers\Api\TransactionResource | show | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/TransactionsController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/TransactionsController.php | MIT |
public function update(UpdateRequest $transactionUpdateForm, Transaction $transaction)
{
$transaction = $transactionUpdateForm->save();
return response()->json([
'message' => __('transaction.updated'),
'data' => new TransactionResource($transaction),
]);
} | Update the specified transaction in storage.
@return \Illuminate\Http\JsonResponse | update | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/TransactionsController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/TransactionsController.php | MIT |
public function destroy(Transaction $transaction)
{
$this->authorize('delete', $transaction);
request()->validate(['transaction_id' => 'required']);
if (request('transaction_id') == $transaction->id && $transaction->delete()) {
return response()->json(['message' => __('transaction.deleted')]);
}
return response()->json(['message' => __('transaction.undeleted')]);
} | Remove the specified transaction from storage.
@return \Illuminate\Http\JsonResponse | destroy | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/TransactionsController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/TransactionsController.php | MIT |
public function index()
{
$categories = Category::all();
return $categories;
} | Get a listing of the category.
@return \Illuminate\Http\Response | index | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/CategoriesController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/CategoriesController.php | MIT |
public function store(CreateRequest $categoryCreateForm)
{
$category = $categoryCreateForm->save();
return response()->json([
'message' => __('category.created'),
'data' => $category->fresh(),
], 201);
} | Store a newly created category in storage.
@return \Illuminate\Http\Response | store | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/CategoriesController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/CategoriesController.php | MIT |
public function update(UpdateRequest $categoryUpdateForm, Category $category)
{
$category = $categoryUpdateForm->save();
return response()->json([
'message' => __('category.updated'),
'data' => $category,
]);
} | Update the specified category in storage.
@return \Illuminate\Http\Response | update | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/CategoriesController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/CategoriesController.php | MIT |
public function destroy(DeleteRequest $categoryDeleteForm, Category $category)
{
if ($categoryDeleteForm->delete()) {
return response()->json(['message' => __('category.deleted')]);
}
return response()->json('Unprocessable Entity.', 422);
} | Remove the specified category from storage.
@return \Illuminate\Http\Response | destroy | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/CategoriesController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/CategoriesController.php | MIT |
protected function sendLoginResponse(Request $request)
{
$this->clearLoginAttempts($request);
return new UserResource($request->user());
} | Send the response after the user was authenticated.
@return \Illuminate\Http\Response | sendLoginResponse | php | buku-masjid/buku-masjid | app/Http/Controllers/Api/Auth/LoginController.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Controllers/Api/Auth/LoginController.php | MIT |
public function toArray($request)
{
$transaction = $this->resource;
return [
'id' => $transaction->id,
'date' => $transaction->date,
'amount' => (float) $transaction->amount,
'amount_string' => $transaction->amount_string,
'description' => $transaction->description,
'in_out' => (int) $transaction->in_out,
'book_id' => $transaction->book_id,
'book' => $transaction->book->name,
'category_id' => $transaction->category_id,
'category' => optional($transaction->category)->name,
'category_color' => optional($transaction->category)->color,
'partner_id' => $transaction->partner_id,
'partner' => optional($transaction->partner)->name,
'created_at' => $transaction->created_at->format('Y-m-d H:i:s'),
'updated_at' => $transaction->updated_at->format('Y-m-d H:i:s'),
];
} | Transform the resource into an array.
@param \Illuminate\Http\Request $request
@return array | toArray | php | buku-masjid/buku-masjid | app/Http/Resources/Transaction.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Resources/Transaction.php | MIT |
public function toArray($request)
{
return parent::toArray($request);
} | Transform the resource collection into an array.
@param \Illuminate\Http\Request $request
@return array | toArray | php | buku-masjid/buku-masjid | app/Http/Resources/TransactionCollection.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Resources/TransactionCollection.php | MIT |
public function toArray($request)
{
$user = $this->resource;
$responsData = [
'id' => $user->id,
'name' => $user->name,
'email' => $user->email,
'status' => $user->status,
];
return $responsData;
} | Transform the resource into an array.
@param \Illuminate\Http\Request $request
@return array | toArray | php | buku-masjid/buku-masjid | app/Http/Resources/User.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Http/Resources/User.php | MIT |
function get_years()
{
$yearRange = range(2020, date('Y'));
foreach ($yearRange as $year) {
$years[$year] = $year;
}
return $years;
} | Get array of year list starting from 2018.
@return array | get_years | php | buku-masjid/buku-masjid | app/Helpers/date_time.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Helpers/date_time.php | MIT |
function month_id($monthNumber)
{
if (is_null($monthNumber)) {
return $monthNumber;
}
$months = get_months();
$monthNumber = month_number($monthNumber);
return $months[$monthNumber];
} | Get month name from given month number.
@param int|string $monthNumber
@return string | month_id | php | buku-masjid/buku-masjid | app/Helpers/date_time.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Helpers/date_time.php | MIT |
function flash($message = null, $level = 'info')
{
$session = app('session');
if (!is_null($message)) {
$session->flash('flash_notification.message', $message);
$session->flash('flash_notification.level', $level);
}
} | Function helper to add flash notification.
@param null|string $message The flashed message.
@param string $level Level/type of message
@return void | flash | php | buku-masjid/buku-masjid | app/Helpers/functions.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Helpers/functions.php | MIT |
function balance($perDate = null, $startDate = null, $categoryId = null, $bookId = null)
{
$transactionQuery = DB::table('transactions');
if ($perDate) {
$transactionQuery->where('date', '<=', $perDate);
}
if ($startDate) {
$transactionQuery->where('date', '>=', $startDate);
}
if ($categoryId) {
$transactionQuery->where('category_id', $categoryId);
}
if ($bookId) {
$transactionQuery->where('book_id', $bookId);
}
$transactions = $transactionQuery->where('creator_id', auth()->id())->get();
return $transactions->sum(function ($transaction) {
return $transaction->in_out ? $transaction->amount : -$transaction->amount;
});
} | Get balance amount based on transactions.
@param string|null $perDate
@param string|null $startDate
@return float | balance | php | buku-masjid/buku-masjid | app/Helpers/functions.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Helpers/functions.php | MIT |
public function creator()
{
return $this->belongsTo(User::class);
} | Category belongs to user creator relation.
@return \Illuminate\Database\Eloquent\Relations\BelongsTo | creator | php | buku-masjid/buku-masjid | app/Models/Category.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Models/Category.php | MIT |
public function transactions()
{
return $this->hasMany(Transaction::class);
} | Category has many transactions relation.
@return \Illuminate\Database\Eloquent\Relations\HasMany | transactions | php | buku-masjid/buku-masjid | app/Models/Category.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Models/Category.php | MIT |
public function getNameLabelAttribute()
{
return '<span class="badge" style="background-color: '.$this->color.'">'.$this->name.'</span>';
} | Get category name label attribute.
@return string | getNameLabelAttribute | php | buku-masjid/buku-masjid | app/Models/Category.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Models/Category.php | MIT |
public function report(Throwable $exception)
{
parent::report($exception);
} | Report or log an exception.
This is a great spot to send exceptions to Sentry, Bugsnag, etc.
@return void | report | php | buku-masjid/buku-masjid | app/Exceptions/Handler.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Exceptions/Handler.php | MIT |
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
} | Render an exception into an HTTP response.
@param \Illuminate\Http\Request $request
@return \Illuminate\Http\Response | render | php | buku-masjid/buku-masjid | app/Exceptions/Handler.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Exceptions/Handler.php | MIT |
protected function schedule(Schedule $schedule)
{
// Auto backup database.
$backupCommand = 'db:backup --database=mysql';
$backupCommand .= ' --destination=local --compression=gzip';
$backupCommand .= ' --destinationPath=backup/db/auto.'.date('Y-m-d_Hi');
$schedule->command($backupCommand)->dailyAt('03:00');
} | Define the application's command schedule.
@return void | schedule | php | buku-masjid/buku-masjid | app/Console/Kernel.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Console/Kernel.php | MIT |
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
} | Register the commands for the application.
@return void | commands | php | buku-masjid/buku-masjid | app/Console/Kernel.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Console/Kernel.php | MIT |
public function boot()
{
parent::boot();
Event::listen(function (MigrationsEnded $event) {
$oldMigrationLog = DB::table('migrations')
->where('migration', '2023_08_25_103840_create_lecturing_schedules_table')
->first();
if (is_null($oldMigrationLog)) {
return;
}
DB::table('migrations')->where('migration', '2023_08_25_103840_create_lecturings_table')->delete();
DB::table('migrations')->where('migration', '2023_08_25_103840_create_lecturing_schedules_table')
->update(['migration' => '2023_08_25_103840_create_lecturings_table']);
});
} | Register any events for your application.
@return void | boot | php | buku-masjid/buku-masjid | app/Providers/EventServiceProvider.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Providers/EventServiceProvider.php | MIT |
public function boot()
{
//
parent::boot();
Route::bind('transaction', function ($id) {
return Transaction::withoutGlobalScope('forActiveBook')->where('id', $id)->firstOrFail();
});
Route::bind('donor', function ($id) {
return Partner::where('id', $id)->whereJsonContains('type_code', 'donatur')->firstOrFail();
});
} | Define your route model bindings, pattern filters, etc.
@return void | boot | php | buku-masjid/buku-masjid | app/Providers/RouteServiceProvider.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Providers/RouteServiceProvider.php | MIT |
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
} | Define the routes for the application.
@return void | map | php | buku-masjid/buku-masjid | app/Providers/RouteServiceProvider.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Providers/RouteServiceProvider.php | MIT |
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
} | Define the "web" routes for the application.
These routes all receive session state, CSRF protection, etc.
@return void | mapWebRoutes | php | buku-masjid/buku-masjid | app/Providers/RouteServiceProvider.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Providers/RouteServiceProvider.php | MIT |
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
} | Define the "api" routes for the application.
These routes are typically stateless.
@return void | mapApiRoutes | php | buku-masjid/buku-masjid | app/Providers/RouteServiceProvider.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Providers/RouteServiceProvider.php | MIT |
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
} | Bootstrap any application services.
@return void | boot | php | buku-masjid/buku-masjid | app/Providers/BroadcastServiceProvider.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Providers/BroadcastServiceProvider.php | MIT |
public function boot()
{
require_once app_path().'/Helpers/functions.php';
require_once app_path().'/Helpers/date_time.php';
Paginator::useBootstrap();
Relation::enforceMorphMap([
'books' => Book::class,
'users' => User::class,
'bank_accounts' => BankAccount::class,
'transactions' => Transaction::class,
]);
// Ref: https://dzone.com/articles/how-to-use-laravel-macro-with-example
SessionGuard::macro('activeBook', function () {
$activeBook = Book::find($this->activeBookId());
if (is_null($activeBook)) {
$activeBook = Book::find(config('masjid.default_book_id'));
}
return $activeBook;
});
SessionGuard::macro('activeBookId', function () {
if (($bookId = request()->get('active_book_id')) && ($nonce = request()->get('nonce'))) {
$activeBook = Book::find($bookId);
if (!is_null($activeBook) && $activeBook->nonce == $nonce) {
return $bookId;
}
}
return $this->getSession()->get('active_book_id') ?: config('masjid.default_book_id');
});
TokenGuard::macro('activeBook', function () {
$activeBook = Book::find($this->activeBookId());
if (is_null($activeBook)) {
$activeBook = Book::find(config('masjid.default_book_id'));
}
return $activeBook;
});
TokenGuard::macro('activeBookId', function () {
return request()->get('active_book_id') ?: config('masjid.default_book_id');
});
SessionGuard::macro('setActiveBook', function ($activeBookId) {
$this->getSession()->put('active_book_id', $activeBookId);
});
View::composer(['layouts._top_nav_active_book'], function ($view) {
$activeBooks = Book::where('status_id', Book::STATUS_ACTIVE)->pluck('name', 'id');
return $view->with('activeBooks', $activeBooks);
});
} | Bootstrap any application services.
@return void | boot | php | buku-masjid/buku-masjid | app/Providers/AppServiceProvider.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Providers/AppServiceProvider.php | MIT |
public function register()
{
//
} | Register any application services.
@return void | register | php | buku-masjid/buku-masjid | app/Providers/AppServiceProvider.php | https://github.com/buku-masjid/buku-masjid/blob/master/app/Providers/AppServiceProvider.php | MIT |
private function set_user_agent() {
if (!empty($this->config['user_agent']))
return;
$ssl = ($this->config['curl_ssl_verifyhost'] && $this->config['curl_ssl_verifypeer'] && $this->config['use_ssl']) ? '+' : '-';
$ua = 'tmhOAuth ' . self::VERSION . $ssl . 'SSL - //github.com/themattharris/tmhOAuth';
$this->config['user_agent'] = $ua;
} | Sets the useragent for PHP to use
If '$this->config['user_agent']' already has a value it is used instead of one
being generated.
@return void value is stored to the config array class variable | set_user_agent | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function nonce($length=12, $include_time=true) {
if ($this->config['force_nonce'] === false) {
$prefix = $include_time ? microtime() : '';
return md5(substr($prefix . uniqid(), 0, $length));
} else {
return $this->config['force_nonce'];
}
} | Generates a random OAuth nonce.
If 'force_nonce' is false a nonce will be generated, otherwise the value of '$this->config['force_nonce']' will be used.
@param string $length how many characters the nonce should be before MD5 hashing. default 12
@param string $include_time whether to include time at the beginning of the nonce. default true
@return $nonce as a string | nonce | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function timestamp() {
if ($this->config['force_timestamp'] === false) {
$time = time();
} else {
$time = $this->config['force_timestamp'];
}
return (string) $time;
} | Generates a timestamp.
If 'force_timestamp' is false a timestamp will be generated, otherwise the value of '$this->config['force_timestamp']' will be used.
@return $time as a string | timestamp | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function safe_encode($data) {
if (is_array($data)) {
return array_map(array($this, 'safe_encode'), $data);
} else if (is_scalar($data)) {
return str_ireplace(
array('+', '%7E'),
array(' ', '~'),
rawurlencode($data)
);
} else {
return '';
}
} | Encodes the string or array passed in a way compatible with OAuth.
If an array is passed each array value will will be encoded.
@param mixed $data the scalar or array to encode
@return $data encoded in a way compatible with OAuth | safe_encode | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function safe_decode($data) {
if (is_array($data)) {
return array_map(array($this, 'safe_decode'), $data);
} else if (is_scalar($data)) {
return rawurldecode($data);
} else {
return '';
}
} | Decodes the string or array from it's URL encoded form
If an array is passed each array value will will be decoded.
@param mixed $data the scalar or array to decode
@return string $data decoded from the URL encoded form | safe_decode | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function prepare_method() {
$this->request_settings['method'] = strtoupper($this->request_settings['method']);
} | Prepares the HTTP method for use in the base string by converting it to
uppercase.
@return void value is stored to the class variable '$this->request_settings['method']' | prepare_method | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function prepare_url() {
$parts = parse_url($this->request_settings['url']);
$port = isset($parts['port']) ? $parts['port'] : false;
$scheme = $parts['scheme'];
$host = $parts['host'];
$path = isset($parts['path']) ? $parts['path'] : false;
$port or $port = ($scheme == 'https') ? '443' : '80';
if (($scheme == 'https' && $port != '443') || ($scheme == 'http' && $port != '80')) {
$host = "$host:$port";
}
// the scheme and host MUST be lowercase
$this->request_settings['url'] = strtolower("$scheme://$host");
// but not the path
$this->request_settings['url'] .= $path;
} | Prepares the URL for use in the base string by ripping it apart and
reconstructing it.
Ref: 3.4.1.2
@return void value is stored to the class array variable '$this->request_settings['url']' | prepare_url | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function multipart_escape($value) {
if (!$this->request_settings['multipart'] || strpos($value, '@') !== 0)
return $value;
// see if the parameter is a file.
// we split on the semi-colon as it's the delimiter used on media uploads
// for fields with semi-colons this will return the original string
list($file) = explode(';', substr($value, 1), 2);
if (file_exists($file))
return $value;
return " $value";
} | If the request uses multipart, and the parameter isn't a file path, prepend a space
otherwise return the original value. we chose a space here as twitter whitespace trims from
the beginning of the tweet. we don't use \0 here because it's the character for string
termination.
@param the parameter value
@return string the original or modified string, depending on the request and the input parameter | multipart_escape | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function prepare_signing_key() {
$left = $this->safe_encode($this->config['consumer_secret']);
$right = $this->safe_encode($this->secret());
$this->request_settings['signing_key'] = $left . '&' . $right;
} | Prepares the OAuth signing key
@return void prepared signing key is stored in the class variable 'signing_key' | prepare_signing_key | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function oauth1_request() {
$this->prepare_oauth1_params();
$this->prepare_method();
$this->prepare_url();
$this->prepare_params();
$this->prepare_base_string();
$this->prepare_signing_key();
$this->prepare_oauth_signature();
$this->prepare_auth_header();
return $this->curlit();
} | Signs the request and adds the OAuth signature. This runs all the request
parameter preparation methods.
@param string $method the HTTP method being used. e.g. POST, GET, HEAD etc
@param string $url the request URL without query string parameters
@param array $params the request parameters as an array of key=value pairs
@param boolean $with_user whether to include the user credentials when making the request.
@return void | oauth1_request | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function update_metrics() {
$now = time();
if (($this->metrics['interval_start'] + $this->config['streaming_metrics_interval']) > $now)
return null;
$this->metrics['mps'] = round( ($this->metrics['messages'] - $this->metrics['last_messages']) / $this->config['streaming_metrics_interval'], 2);
$this->metrics['bps'] = round( ($this->metrics['bytes'] - $this->metrics['last_bytes']) / $this->config['streaming_metrics_interval'], 2);
$this->metrics['last_bytes'] = $this->metrics['bytes'];
$this->metrics['last_messages'] = $this->metrics['messages'];
$this->metrics['interval_start'] = $now;
return $this->metrics;
} | Handles the updating of the current Streaming API metrics.
@return array the metrics for the streaming api connection | update_metrics | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
public function url($request, $extension='json') {
// remove multi-slashes
$request = preg_replace('$([^:])//+$', '$1/', $request);
if (stripos($request, 'http') === 0 || stripos($request, '//') === 0) {
return $request;
}
$extension = strlen($extension) > 0 ? ".$extension" : '';
$proto = $this->config['use_ssl'] ? 'https:/' : 'http:/';
// trim trailing slash
$request = ltrim($request, '/');
$pos = strlen($request) - strlen($extension);
if (substr($request, $pos) === $extension)
$request = substr_replace($request, '', $pos);
return implode('/', array(
$proto,
$this->config['host'],
$request . $extension
));
} | Utility function to create the request URL in the requested format.
If a fully-qualified URI is provided, it will be returned.
Any multi-slashes (except for the protocol) will be replaced with a single slash.
@param string $request the API method without extension
@param string $extension the format of the response. Default json. Set to an empty string to exclude the format
@return string the concatenation of the host, API version, API method and format, or $request if it begins with http | url | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
public function transformText($text, $mode='encode') {
return $this->{"safe_$mode"}($text);
} | Public access to the private safe decode/encode methods
@param string $text the text to transform
@param string $mode the transformation mode. either encode or decode
@return string $text transformed by the given $mode | transformText | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function curlHeader($ch, $header) {
$this->response['raw'] .= $header;
list($key, $value) = array_pad(explode(':', $header, 2), 2, null);
$key = trim($key);
$value = trim($value);
if ( ! isset($this->response['headers'][$key])) {
$this->response['headers'][$key] = $value;
} else {
if (!is_array($this->response['headers'][$key])) {
$this->response['headers'][$key] = array($this->response['headers'][$key]);
}
$this->response['headers'][$key][] = $value;
}
return strlen($header);
} | Utility function to parse the returned curl headers and store them in the
class array variable.
@param object $ch curl handle
@param string $header the response headers
@return string the length of the header | curlHeader | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
private function curlWrite($ch, $data) {
$l = strlen($data);
if (strpos($data, $this->config['streaming_eol']) === false) {
$this->buffer .= $data;
return $l;
}
$buffered = explode($this->config['streaming_eol'], $data);
$content = $this->buffer . $buffered[0];
$this->metrics['messages']++;
$this->metrics['bytes'] += strlen($content);
if ( ! is_callable($this->config['streaming_callback']))
return 0;
$metrics = $this->update_metrics();
$stop = call_user_func(
$this->config['streaming_callback'],
$content,
strlen($content),
$metrics
);
$this->buffer = $buffered[1];
if ($stop)
return 0;
return $l;
} | Utility function to parse the returned curl buffer and store them until
an EOL is found. The buffer for curl is an undefined size so we need
to collect the content until an EOL is found.
This function calls the previously defined streaming callback method.
@param object $ch curl handle
@param string $data the current curl buffer
@return int the length of the data string processed in this function | curlWrite | php | themattharris/tmhOAuth | tmhOAuth.php | https://github.com/themattharris/tmhOAuth/blob/master/tmhOAuth.php | Apache-2.0 |
public function getMessageBag()
{
return $this->getErrors();
} | Get the messages for the instance.
@return \Illuminate\Support\MessageBag | getMessageBag | php | dwightwatson/validating | src/ValidatingModel.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingModel.php | MIT |
public static function bootValidatingTrait()
{
static::observe(new ValidatingObserver);
} | Boot the trait. Adds an observer class for validating.
@return void | bootValidatingTrait | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function getValidating()
{
return $this->validating;
} | Returns whether or not the model will attempt to validate
itself when saving.
@return bool | getValidating | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function setValidating($value)
{
$this->validating = (boolean) $value;
} | Set whether the model should attempt validation on saving.
@param bool $value
@return void | setValidating | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function getThrowValidationExceptions()
{
return isset($this->throwValidationExceptions) ? $this->throwValidationExceptions : false;
} | Returns whether the model will raise an exception or
return a boolean when validating.
@return bool | getThrowValidationExceptions | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function setThrowValidationExceptions($value)
{
$this->throwValidationExceptions = (boolean) $value;
} | Set whether the model should raise an exception or
return a boolean on a failed validation.
@param bool $value
@return void
@throws InvalidArgumentException | setThrowValidationExceptions | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function getInjectUniqueIdentifier()
{
return isset($this->injectUniqueIdentifier) ? $this->injectUniqueIdentifier : true;
} | Returns whether or not the model will add it's unique
identifier to the rules when validating.
@return bool | getInjectUniqueIdentifier | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function setInjectUniqueIdentifier($value)
{
$this->injectUniqueIdentifier = (boolean) $value;
} | Set the model to add unique identifier to rules when performing
validation.
@param bool $value
@return void
@throws InvalidArgumentException | setInjectUniqueIdentifier | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function getValidationMessages()
{
return isset($this->validationMessages) ? $this->validationMessages : [];
} | Get the custom validation messages being used by the model.
@return array | getValidationMessages | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
protected function modelValidationMessages()
{
return (new static)->getValidationMessages();
} | Handy method for using the static call Model::validationMessages().
Protected access only to allow __callStatic to get to it.
@return array | modelValidationMessages | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function getValidationAttributeNames()
{
return isset($this->validationAttributeNames) ? $this->validationAttributeNames : [];
} | Get the validating attribute names.
@return array | getValidationAttributeNames | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
protected function modelValidationAttributeNames()
{
return (new static)->getValidationAttributeNames();
} | Handy method for using the static call Model::validationAttributeNames().
Protected access only to allow __callStatic to get to it.
@return array | modelValidationAttributeNames | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function setValidationAttributeNames(?array $attributeNames = null)
{
$this->validationAttributeNames = $attributeNames;
} | Set the validating attribute names.
@param array $attributeNames
@return void | setValidationAttributeNames | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function getRules()
{
return isset($this->rules) ? $this->rules : [];
} | Get the global validation rules.
@return array | getRules | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function getPreparedRules()
{
return $this->injectUniqueIdentifierToRules($this->getRules());
} | Get the validation rules after being prepared by the injectors.
@return array | getPreparedRules | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
protected function rules()
{
return $this->getRules();
} | Handy method for using the static call Model::rules(). Protected access
only to allow __callStatic to get to it.
@return array | rules | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function setRules(?array $rules = null)
{
$this->rules = $rules;
} | Set the global validation rules.
@param array $rules
@return void | setRules | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function getErrors()
{
return $this->validationErrors ?: new MessageBag;
} | Get the validation error messages from the model.
@return \Illuminate\Support\MessageBag | getErrors | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function isValid()
{
$rules = $this->getRules();
return $this->performValidation($rules);
} | Returns whether the model is valid or not.
@return bool | isValid | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function isValidOrFail()
{
if ( ! $this->isValid()) {
$this->throwValidationException();
}
return true;
} | Returns if the model is valid, otherwise throws an exception.
@return bool
@throws \Watson\Validating\ValidationException | isValidOrFail | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function isInvalid()
{
return ! $this->isValid();
} | Returns whether the model is invalid or not.
@return bool | isInvalid | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function forceSave(array $options = [])
{
$currentValidatingSetting = $this->getValidating();
$this->setValidating(false);
$result = $this->getModel()->save($options);
$this->setValidating($currentValidatingSetting);
return $result;
} | Force the model to be saved without undergoing validation.
@param array $options
@return bool | forceSave | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function saveOrFail(array $options = [])
{
if ($this->isInvalid()) {
return $this->throwValidationException();
}
return $this->getModel()->parentSaveOrFail($options);
} | Perform a one-off save that will raise an exception on validation error
instead of returning a boolean (which is the default behaviour).
@param array $options
@return bool
@throws \Throwable | saveOrFail | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function parentSaveOrFail($options)
{
return parent::saveOrFail($options);
} | Call the parent save or fail method provided by Eloquent.
@param array $options
@return bool
@throws \Throwable | parentSaveOrFail | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function saveOrReturn(array $options = [])
{
return $this->getModel()->save($options);
} | Perform a one-off save that will return a boolean on
validation error instead of raising an exception.
@param array $options
@return bool | saveOrReturn | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
protected function makeValidator($rules = [])
{
// Get the casted model attributes.
$attributes = $this->getModelAttributes();
if ($this->getInjectUniqueIdentifier()) {
$rules = $this->injectUniqueIdentifierToRules($rules);
}
$messages = $this->getValidationMessages();
$validator = $this->getValidator()->make($attributes, $rules, $messages);
if ($this->getValidationAttributeNames()) {
$validator->setAttributeNames($this->getValidationAttributeNames());
}
$this->withValidator($validator);
return $validator;
} | Make a Validator instance for a given ruleset.
@param array $rules
@return \Illuminate\Contracts\Validation\Validator | makeValidator | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
protected function withValidator($validator)
{
//
} | Provide a hook to interact with the validator before it is used.
@param \Illuminate\Contracts\Validation\Validator $validator
@return void | withValidator | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
protected function performValidation($rules = [])
{
$validation = $this->makeValidator($rules);
$result = $validation->passes();
$this->setErrors($validation->messages());
return $result;
} | Validate the model against it's rules, returning whether
or not it passes and setting the error messages on the
model if required.
@param array $rules
@return bool
@throws \Watson\Validating\ValidationException | performValidation | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function updateRulesUniques()
{
$rules = $this->getRules();
$this->setRules($this->injectUniqueIdentifierToRules($rules));
} | Update the unique rules of the global rules to
include the model identifier.
@return void | updateRulesUniques | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.