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 | |
// Add scope methods in model class | |
public function scopeConditionOne($query) | |
{ | |
return $query->where('column_1', '=', 100); | |
} | |
public function scopeConditionTwo($query) | |
{ |
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
class Student { | |
private $studentName; | |
public __construct($studentName){ | |
$this->studentName = $studentName; | |
} | |
} | |
class School { | |
private $student; |
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
class Student { | |
private $studentName; | |
public __construct($studentName){ | |
$this->studentName = $studentName; | |
} | |
} | |
class School { | |
private $student; | |
private $schoolName; |
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
"repositories": [ | |
{ | |
"type": "path", | |
"url": "./nova" | |
} | |
], |
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
"require": { | |
"php": "^7.2.5", | |
"fideloper/proxy": "^4.2", | |
"laravel/framework": "^7.0", | |
"laravel/nova": "*" | |
}, |
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 Laravel\Nova\Fields\ID; | |
use Laravel\Nova\Fields\Text; | |
/** | |
* Get the fields displayed by the resource. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @return array |
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
/* CustomModal.vue */ | |
<template> | |
<modal tabindex="-1" role="dialog" @modal-close="handleClose"> | |
<form @keydown="handleKeydown" @submit.prevent.stop="handleConfirm" class="bg-white rounded-lg shadow-lg overflow-hidden w-action"> | |
<div> | |
<heading :level="2" class="border-b border-40 py-8 px-8">Confirm action</heading> | |
<p class="text-80 px-8 my-8"> Are you sure you want to perform this action? </p> | |
</div> | |
<div class="bg-30 px-6 py-3 flex"> |
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 | |
public function fields(Request $request) | |
{ | |
return [ | |
ID::make()->sortable(), | |
Text::make('Name'), | |
Text::make('Description'), | |
Tags::make('tags') | |
// I need an author_id field here. |
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 | |
/** | |
* Handle the post "creating" event. | |
* | |
* @param \App\Post $post | |
* @return void | |
*/ | |
public function creating(Post $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
<?php | |
public function boot() | |
{ | |
Nova::serving(function () { | |
Post::observe(PostObserver::class); | |
}); | |
} |