Skip to content

Instantly share code, notes, and snippets.

@abbajbryant
abbajbryant / AttachJwtToken.php
Created August 14, 2021 18:14 — forked from jgrossi/AttachJwtToken.php
AttachJwtToken.php
<?php
namespace Tests\Concerns;
use App\Models\User;
use Tymon\JWTAuth\Facades\JWTAuth;
trait AttachJwtToken
{
/**
<?php
class ExamplesController extends AppController {
public $fileCounts = array( );
public function countFilesByExtension( $fileExtension, $directoryPath ){
return $this->setFileCounts( $fileExtension, count( glob( "{$directory}*.{$fileExtension}" )));
}
@abbajbryant
abbajbryant / database.php
Created September 22, 2011 02:27
database config file used with bake error
<?php
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => 'XXXXXXXXXX',
'database' => 'foundry',
@abbajbryant
abbajbryant / bake error dump
Created September 22, 2011 02:22
Cake 2.0.0-RC2 "bake Model" issues with working database settings
abbas-macbook-pro:Console abba$ ./cake bake Model
Welcome to CakePHP v2.0.0-RC2 Console
---------------------------------------------------------------
App : app
Path: /Users/abba/Sites/foundry/app/
---------------------------------------------------------------
---------------------------------------------------------------
Bake Model
Path: /Users/abba/Sites/foundry/app/Model/
@abbajbryant
abbajbryant / gist:1073889
Created July 9, 2011 19:51
virtualField count example for Dominik Gajewski
<?php
class DepartmentBook extends AppModel
{
public $name = "DepartmentBook";
public $virtualFields = array(
'kl' => 'count(*)',
);
}
?>
@abbajbryant
abbajbryant / fpdf_example
Created June 30, 2011 05:48
Quick and dirty implementation for importing and extending the fpdf.php class using a custom vendor and helper
<?php
// Place this in the same folder as the fpdf.php referenced in the App::import below with the filename report_pdf.php
App::import( 'Vendor', 'FPDF', array(
'file' => join( DS, array( 'fpdf', 'fpdf.php' )),
));
* ReportPdf
* an example fpdf extension for Dominik Gajewski re: google groups topic FPFD or PDFLib with Cake
* this is where you would implement all the custom functions, ie header, footer, columns.
* @author Abba Bryant
{{[
html.docType,
html.tag( 'html',[
html.tag( 'head',[
html.charset,
html.tag( 'title', title_for_layout|trans ),
html.css([
'cake.generic'
], null, [ 'media' : 'screen, projection' ]),
html.script([