Showing posts with label PHP Laravel Framework. Show all posts
Showing posts with label PHP Laravel Framework. Show all posts

Tuesday, June 8, 2021

Laravel Route Parameters With Slash



Route::get ( '/routepath/{param?}', [
'as' => 'routepath',
'uses' => 'MyAddController@myAdd'
] )->where('param', '[A-Za-z0-9_/-]+');

* param can contain value with slash

Thursday, April 30, 2020

Change Laravel built-in development web server document root



> php -S localhost:8080 -t "D:\xampp72\htdocs\laravel-web"

* -t = Specify document root <docroot> for built-in web server

Tuesday, September 24, 2019

PHP Laravel Lock For Update with Eloquent



public function lockForUpdate()
    {
     \DB::transaction(function () {
      $update = JasperReportParam::where('ID','=', 26262)->lockForUpdate()->first();
      $update->ID = 26262;
      $update->status   = 'LOCK';
      $update->save();
     });
    }
* The selected row will be locked from being selected or updated by other process. This will solve race condition issue in updating the same record.

Thursday, October 4, 2018

How to increase laravel controller method execution time



public function postGetEvents1(){

    // Get default limit
    $normalTimeLimit = ini_get('max_execution_time');

    // Set new limit
    ini_set('max_execution_time', 600); 

    //other code

    // Restore default limit
    ini_set('max_execution_time', $normalTimeLimit); 

    return;
}

Thursday, July 19, 2018

How to post external page to PHP Laravel Framework




Route for your controller example:
/project_laravel/app/Modules/MyModule/Http/routes.php



Controller example:
/project_laravel/app/Modules/MyModule/Http/Controller/ ExtReportController.php



Controller URI should be excluded from CRSF verification:
/project_laravel/app/Http/Middleware/VerifyCrsfToken.php

PHP Laravel Framework