Skip to content

Instantly share code, notes, and snippets.

View rizkhal's full-sized avatar
🌴
On vacation

Rizkal rizkhal

🌴
On vacation
View GitHub Profile
<h1 class="text-center font-weight-bold text-primary mt-4">
{{ $slot }}
</h1>
<a href="{{$url}}" class="btn btn-sm btn-info mb-2">{{$text}}</a>
@extends('layouts.master')
@push('heading')
@component('components.heading')
New Post
@endcomponent
@endpush
@push('button')
@component('components.button')
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<title>Larave repository desing pattern</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}" />
<!-- Styles -->
<link rel="stylesheet" href="{{ asset('assets/css/bootstrap.min.css') }}">
@rizkhal
rizkhal / helper.php
Last active February 22, 2020 07:54
<?php
if (! function_exists('notice')) {
function notice($type, $content) {
$notices = session()->get('notice');
if(! is_array( $notices ))
$notices = [];
array_push($notices, [
'type' => $type,
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\PostRequestValidate;
use App\Repositories\PostRepositoryInterface as PostEloquent;
class PostController extends Controller
<?php
namespace App\Http\Requests;
use Illuminate\Support\Str;
use Illuminate\Foundation\Http\FormRequest;
class PostRequestValidate extends FormRequest
{
/**
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class RepositoryServiceProvider extends ServiceProvider
{
/**
* Register services.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePostsTable extends Migration
{
//...
public function up()
<?php
namespace App\Repositories\Eloquent;
use App\Repositories\Eloquent\Entities\Post;
use App\Repositories\PostRepositoryInterface as PostInterface;
class PostEloquent implements PostInterface
{
protected $model;