Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade demo app #210

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion example/app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
Expand Down
5 changes: 2 additions & 3 deletions example/app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
public function index() {
public function index()
{
return view('home.index');
}
}
28 changes: 19 additions & 9 deletions example/app/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,56 @@

use App\Models\Post;
use Illuminate\Http\Request;
use Illuminate\Support\Str;

class PostController extends Controller
{
public function index() {
public function index()
{
$posts = Post::all();

return view('posts.index', compact('posts'));
}

public function show(Post $post) {
public function show(Post $post)
{
return view('posts.show', compact('post'));
}

public function create() {
public function create()
{
return view('posts.create');
}

public function store(Request $request) {
public function store(Request $request)
{
$data = $request->validate([
'title' => ['required', 'string'],
'slug' => ['string'],
'content' => ['string']
'content' => ['string'],
]);

$post = Post::create($data);
$post = Post::create([
...$data,
'slug' => Str::slug($data['title']),
]);

return redirect(
route('posts.show', compact('post'))
);
}

public function edit(Post $post) {
public function edit(Post $post)
{
return view('posts.edit', compact('post'));
}

public function update(Request $request, Post $post) {
public function update(Request $request, Post $post)
{
$data = $request->validate([
'title' => ['string'],
'slug' => ['string'],
'content' => ['string']
'content' => ['string'],
]);

$post->update($data);
Expand Down
3 changes: 2 additions & 1 deletion example/app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Http\Middleware\HandleCors;

class Kernel extends HttpKernel
{
Expand All @@ -16,7 +17,7 @@ class Kernel extends HttpKernel
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
Expand Down
2 changes: 0 additions & 2 deletions example/app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null ...$guards
* @return mixed
*/
Expand Down
1 change: 0 additions & 1 deletion example/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
Expand Down
1 change: 1 addition & 0 deletions example/app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function boot()
Laraberg::registerBlockType('example/server-side-render-block', [], function ($attributes, $content) {
ob_start();
dump($attributes);

return ob_get_clean();
});

Expand Down
1 change: 0 additions & 1 deletion example/app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Providers;

use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;

class AuthServiceProvider extends ServiceProvider
{
Expand Down
31 changes: 17 additions & 14 deletions example/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"repositories": [
{
Expand All @@ -11,22 +14,22 @@
}
],
"require": {
"php": "^7.3|^8.1",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.54",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"php": "^8.2",
"guzzlehttp/guzzle": "^7.9.2",
"laravel/framework": "^11.0",
"laravel/pint": "^1.17",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9",
"van-ons/laraberg": "@dev"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.10",
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
"barryvdh/laravel-ide-helper": "^3.1.0",
"spatie/laravel-ignition": "^2.0",
"fakerphp/faker": "^1.23.1",
"laravel/sail": "^1.25.0",
"mockery/mockery": "^1.6.12",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading