Skip to content

Instantly share code, notes, and snippets.

//Router wyglada tak
Router::connect(
'/forum/:id-:slug', // E.g. /blog/3-CakePHP_Rocks
array('controller' => 'forum', 'action' => 'show'),
array(
// order matters since this will simply map ":id" to $articleId in your action
'pass' => array('id', 'slug'),
'id' => '[0-9]+'
)
);
@marcincodes
marcincodes / gist:7397947
Created November 10, 2013 12:59
Router do paginacji
//routes.php
Router::connect(
'/forum/:id-:slug/*', // E.g. /blog/3-CakePHP_Rocks
array('controller' => 'forum', 'action' => 'show'),
array(
// order matters since this will simply map ":id" to $articleId in your action
'pass' => array('id', 'slug'),
'id' => '[0-9]+'
)
);
//debug
array(
(int) 0 => array(
'Theard' => array(
'id' => '1',
'name' => 'Pierwszy post testowy 1',
'slug' => 'pierwszy-post-testowy-1',
'body' => 'body',
'by' => 'PerfectM',
'date' => '2013-10-17 12:31:48',
//add ctp
<div class="add topic form">
<?php echo $this->Form->create('Theard'); ?>
<fieldset>
<legend><?php echo __('Add Topic'); ?></legend>
<?php
echo $this->Form->input('name');
echo $this->Form->input('Post.body');
?>
</fieldset>
//Theard
public $validate = array(
'name' => array(
'notEmpty' => array(
'rule' => array('notEmpty'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('initDB'); // We can remove this line after we're finished
}
public function initDB() {
$group = $this->User->Group;
// Allow admins to everything
$group->id = 1;
$tickets object Ticket (20)
object (20)
Available methods (165)
Static class properties (10)
protected connection -> NULL
protected table -> NULL
@extends('layout')
@section('content')
@foreach($tickets as $ticket)
{{ $ticket->id }}
@endforeach
@stop
$tickets object Ticket (20)
object (20)
Available methods (165)
Static class properties (10)
protected connection -> NULL
protected table -> NULL
@marcincodes
marcincodes / machine.js
Created April 22, 2021 09:36
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'toggle',
initial: 'inactive',
states: {
inactive: { on: { TOGGLE: 'active' } },
active: { on: { TOGGLE: 'inactive' } }
}
})