Skip to content

Instantly share code, notes, and snippets.

View Mombuyish's full-sized avatar
Never stop progressing.

Yish Mombuyish

Never stop progressing.
View GitHub Profile
<?php
namespace Tests;
//use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Laravel\BrowserKitTesting\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class PostTest extends TestCase
<?php
Route::get('posts/{post}', function($id) {
$post = Post::find($id);
return response()->json($post);
});
<?php
public function boot(Router $router)
{
parent::boot($router);
$router->model('user', 'App\User');
}
<?php
$router->get('profile/{user}', function(App\User $user) {
//
});
<?php
Route::get('posts/{post}', function(Post $post) {
return response()->json($post);
});
<?php
namespace Illuminate\Database\Eloquent;
abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable
{
.
.
.
.
/**
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $guarded = [];
{
"id": 101,
"subject": "yish",
"description": "23232323",
"status": 0,
"created_at": "2017-05-10 07:46:11",
"updated_at": "2017-05-10 07:50:18"
}
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
@foreach($posts as $post)
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="{{ $post->name }}">