laravel Numeric validation

 

$rules = [
"collectingMyProduct.productId" => 'bail|required|',
"collectingMyProduct.productName" => 'bail|required|',
"collectingMyProduct.signaX" => 'bail|required|digits_between:1,8|',
"collectingMyProduct.signaHari" => 'bail|required|digits_between:1,1|',
"collectingMyProduct.qty" => 'bail|required|digits_between:1,150|',
"collectingMyProduct.productPrice" => 'bail|required|numeric|',
"collectingMyProduct.catatanKhusu" => 'bail|required|',

];

digits_between :min,max

The field under validation must have a length between the given min and max.

numeric

The field under validation must have a numeric value.

max:value

The field under validation must be less than or equal to a maximum value. Strings, numerics, and files are evaluated in the same fashion as the size rule.

min:value

The field under validation must have a minimum value. Strings, numerics, and files are evaluated in the same fashion as the size rule.

How to get or set UNDO_RETENTION parameter - Oracle

I have recently encountered an issue while trying to export the Oracle DB using the expdp command and my database size was huge, therefore I got an error stating that Snapshot is too old

When I researched further I noticed that my UNDO_RETENTION was too less and set to 900 seconds.

This is how I have managed to get or set the value to this parameter in Oracle

 
How to know the current value of UNDO_RETENTION in Oracle

to know the current or configured value of UNDO_RETENTION parameter in Oracle you can use the following SQL query

In order to be able to execute this SQL command, you must have SQL dba privileges or some specific grants to make you an elevated user

SQL> show parameters undo_retention;

NAME                     TYPE     VALUE
---------------------------------- – – ------- – – ----------------------------
undo_retention                 integer     10600

 
How to modify/set this UNDO_RETENTION value in Oracle

to modify or to set this UNDO_RETENTION value in oracle. you can use the following sql query.

Remember that the value of this parameter is mentioned in seconds.

SQL> ALTER SYSTEM SET UNDO_RETENTION = 10600;

System altered.

You can use the previous SQL statement to make sure that the value is changed or not.

Now you can go ahead and re-run the expdp and hopefully it should be fine.

Good luck

 

 

https://www.middlewareinventory.com/blog/how-to-get-or-set-undo_retention-parameter-oracle/

Remove “api” Prefix from URL on Laravel

 PHP Laravel Framework makes it easy for us to create a Restful API. We just set the routing in the Routes -> api.php section.

By default we will find that we will be given a url like this http://ourdomain.com/api/[end-point]

This is to distinguish between urls that can be accessed via the web or can only be accessed through api. We want to change it to http://ourdomain.com/[end-point] by removing the “api” prefix.

To change it we just go to the RouteServiceProvider.php file in the app/Providers folder

Then in the mapApiRoutes method function section, we can eliminate the prefix (‘api’)

protected function mapApiRoutes()
    {
        Route::prefix('api')
             ->middleware('api')
             ->namespace($this->namespace)
             ->group(base_path('routes/api.php'));
    }

So that the function becomes as follows

protected function mapApiRoutes()
    {
        Route::middleware('api')
             ->namespace($this->namespace)
             ->group(base_path('routes/api.php'));
    }

If we have changed it, then we can access our API with the URL http://ourdomain.com/[end-point]

Handle special character ' in laravel blade template

 

You can escape quote characters with addslashes()

<button id="submit_btn" onclick="submitData('{{addslashes($data)}}')">Save Data</bu

 

 https://stackoverflow.com/questions/54093308/handle-special-character-in-laravel-blade-template

Looping Laravel multiple connect insert and Update

 

// dd('x');
//get table oracle local
DB::connection('oracle')->table('RSMST_DESAS')->select('des_id', 'des_name', 'kec_id', 'st_desa')->get()
->each(
function ($item) {

// dd($item);
//cek record oracle RS // if exist update else insert
$cekrec = DB::connection('oraclers')
->table('RSMST_DESAS')->where('des_id', $item->des_id)
->first();

if ($cekrec) {
// update
DB::connection('oraclers')->table('RSMST_DESAS')
->where('des_id', $item->des_id)
->update([
'des_id' => $item->des_id,
'des_name' => $item->des_name,
'kec_id' => $item->kec_id,
'st_desc' => $item->st_desa,
]);
} else {
// insert
DB::connection('oraclers')->table('RSMST_DESAS')
->insert([
'des_id' => $item->des_id,
'des_name' => $item->des_name,
'kec_id' => $item->kec_id,
'st_desc' => $item->st_desa,



]);
}
}
);


Select-ing Scalar Values | Running SQL Queries on Laravel

Sometimes your database query may result in a single, scalar value. Instead of being required to retrieve the query's scalar result from a record object, Laravel allows you to retrieve this value directly using the scalar method:

$burgers = DB::scalar(
    "select count(case when food = 'burger' then 1 end) as burgers from menu"
);



https://laravel.com/docs/10.x/database