This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Phinx\Migration\AbstractMigration; | |
class CreatePagesTable extends AbstractMigration | |
{ | |
// public function change() | |
// { | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function add() { | |
$post = $this->Posts->newEntity($this->request->data, ['associated' => ['Categories' => ['validate' => 'notEmpty']]]); | |
if ($this->request->is('post')) { | |
$newData = ['user_id' => $this->Auth->user('id')]; | |
// $this->request->data['user_id'] = $this->Auth->user('id'); | |
$post = $this->Posts->patchEntity($post, $newData); | |
// $post->user_id = $this->Auth->user('id'); | |
// debug($post);exit; | |
if ($this->Posts->save($post)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- File: src/Template/Users/add.ctp --> | |
<h1>Add a new User</h1> | |
<?php | |
echo $this->Form->create($user, ['type' => 'file']); | |
echo $this->Form->input('username'); | |
echo $this->Form->input('password'); | |
echo $this->Form->input('date_of_birth', [ | |
'label' => 'Date of birth', | |
'minYear' => date('Y') - 70, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo $this->Form->create($user, ['type' => 'file']); | |
echo $this->Form->input($user, ['type' => 'file']); | |
echo $this->Form->input('profile_image', ['type' => 'file']); | |
echo $this->Form->button(__('Register')); | |
echo $this->Form->end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fatal error: Class 'Proffer\Database\Type\FileType' not found in /home/gaurav/public_html/Cake3/Chitchat/vendor/cakephp/cakephp/src/Database/Type.php on line 105 Call Stack: 0.0001 124860 1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function up() | |
{ | |
Schema::create('articles', function(Blueprint $table) | |
{ | |
$table->increments('id'); | |
$table->string('title'); | |
$table->text('body'); | |
$table->timestamps('published_at'); | |
$table->timestamps(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<td>{!! link_to_action('PostsController@edit', 'Edit Post', $parameters = array($post->id), $attributes = ['class' => 'btn btn-warning']) !!} {!! link_to_action('PostsController@destroy', 'Delete', $parameters = array($post->id), $attributes = ['class' => 'btn btn-danger']) !!}</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//routes.php | |
Route::resource('posts', 'PostsController'); | |
//controller | |
public function show($id) | |
{ | |
$post = Post::findOrFail($id); | |
return view('posts.show', compact('post')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table class="table table-bordered table-striped table-hover"> | |
<tr> | |
<th>Title</th> | |
<th>Description</th> | |
<th>Published on</th> | |
<th>Action</th> | |
</tr> | |
<tr> | |
<td><a href="http://localhost:8080/posts/10">Kuchi ku</a></td> | |
<td>Kuchi ku Kuchi kuKuchi ku Kuchi kuKuchi kuKuchi kuKuchi kuKuchi kuKuchi kuKuchi ku</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@extends('app') | |
@section('content') | |
{!! link_to('posts/create', 'Add Post', ['class' => 'btn btn-primary']) !!} | |
@if ($posts) | |
<hr/> | |
<table class="table table-bordered table-striped table-hover"> | |
<tr> | |
<th>Title</th> |
OlderNewer