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

Latihan blade #4

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion app/Http/Controllers/TaskingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function store(request $request){
$new_tasking->pic = $request->pic;
$new_tasking->status = $request->status;
$new_tasking->save() ;
return redirect('/');
return redirect('/') ->with('toast_success', 'Data Tersimpan');
}

public function destroy($id){
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\RealRashid\SweetAlert\ToSweetAlert::class,

],

'api' => [
Expand Down
4 changes: 3 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace App\Providers;

use Illuminate\Support\Facades\Blade;
use App\view\Components\Alert;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
Expand All @@ -19,6 +21,6 @@ public function register(): void
*/
public function boot(): void
{
//
Blade::component('alert', Alert::class);
}
}
23 changes: 23 additions & 0 deletions app/View/Components/Alert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;

class Alert extends Component
{
public $type;

public $message;

public function __construct($type, $message)
{
$this->type = $type;
$this->message = $message;
}

public function render()
{
return view('components.alert');
}
}
26 changes: 26 additions & 0 deletions app/View/Components/Button.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\View\Components;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class Button extends Component
{
/**
* Create a new component instance.
*/
public function __construct()
{
//
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.button');
}
}
26 changes: 26 additions & 0 deletions app/View/Components/CustomInput.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\View\Components;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class CustomInput extends Component
{
/**
* Create a new component instance.
*/
public function __construct()
{
//
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.custom-input');
}
}
26 changes: 26 additions & 0 deletions app/View/Components/Table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\View\Components;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class Table extends Component
{
/**
* Create a new component instance.
*/
public function __construct()
{
//
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.table');
}
}
26 changes: 26 additions & 0 deletions app/View/Components/test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\View\Components;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class test extends Component
{
/**
* Create a new component instance.
*/
public function __construct()
{
//
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.test');
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8"
"laravel/tinker": "^2.8",
"realrashid/sweet-alert": "^7.1"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
Expand Down
94 changes: 92 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
/*
* Application Service Providers...
*/
RealRashid\SweetAlert\SweetAlertServiceProvider::class,
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
Expand All @@ -183,6 +184,7 @@

'aliases' => Facade::defaultAliases()->merge([
// 'Example' => App\Facades\Example::class,
'Alert' => RealRashid\SweetAlert\Facades\Alert::class,
])->toArray(),

];
Loading