// Make Post Type $person = tr_post_type('Person', 'Team'); // Set Icon $person->setIcon('users'); // Title Only $person->setArgument('supports', ['title'] ); // Set Placeholder Text $person->setTitlePlaceholder('Enter full name here');
class Person extends WPPost { protected $postType = 'person'; // Only save these fields protected $fillable = [ 'photo', 'post_content', 'job_title' ]; // Format photo as an integer protected $format = [ 'photo' => 'intval' ]; }
namespace App\Controllers; use \TypeRocket\Controllers\Controller; class SeatController extends Controller { public function index() { } public function add() { } public function create() { } public function edit() { } public function update() { } public function destroy() { } }
class Seat extends Model { protected $resource = 'seats'; // Belongs To Person public function person() { return $this->belongsTo( Person::class, 'persons_id' ); } }
namespace App\Http\Middleware; use \TypeRocket\Http\Middleware\Middleware; class Example extends Middleware { public function handle() { $request = $this->request; $response = $this->response; // Do stuff before controller is called $this->next->handle(); // Do stuff after controller is called } }
// Remember Me public function show($id) { $seat = new \App\Models\Seat(); $seat->findOrDie($id); $person = $seat->person()->get(); return tr_view('seats.show', compact('seat', 'person')); }