PHP code example of alitnk / radon

1. Go to this page and download the library: Download alitnk/radon library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alitnk / radon example snippets


Product::whereBetweenJalali('created_at', [radon('1398-10-12'), radon('1398-11-12')])->get();

Comment::whereDateJalali('created_at', radon('1400-01-01'))->get(); // Gets all the comments for first day of 1400

Comment::whereDayJalali('created_at', 31); // Gets all comments for 31th

Comment::whereMonthJalali('created_at', 1); // Gets all of Farvardin's comments

Comment::whereYearJalali('created_at', 1400); // Gets all of 1400's comments

use Wama\Radon\Casts\JalaliDatetime;

class Product extends Model {
  protected $casts = [
    'sales_ends_at' => JalaliDatetime::class,
    'updated_at' => JalaliDatetime::class,
    'created_at' => JalaliDatetime::class,
  ];  
}

$product->update([
  'sales_ends_at' => radon('1401-01-14 23:00'), // Sales will end at Farvardin 14th
]);

$product->sales_ends_at->addMonth();
$product->save();