-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0931b13
commit 0787474
Showing
23 changed files
with
433 additions
and
143 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Models\PortfolioCategory; | ||
|
||
class PortfolioCategoryController extends Controller | ||
{ | ||
|
||
|
||
|
||
|
||
|
||
function index(){ | ||
$portfolio_category = PortfolioCategory::latest()->SimplePaginate(10); | ||
return view('admin.portfolio.category.index',compact('portfolio_category')); | ||
} | ||
|
||
function create(Request $request){ | ||
|
||
$request->validate([ | ||
'p_category_name' => 'required', | ||
],[ | ||
'p_category_name.required' => 'Portfolio category field is required.', | ||
]); | ||
|
||
PortfolioCategory::create([ | ||
'p_category_name' => $request->p_category_name, | ||
]); | ||
|
||
session()->flash('success', 'Portfolio Category Added Successfully!'); | ||
return redirect()->route('portfolio.category.index'); | ||
|
||
} | ||
|
||
function inactive($id){ | ||
$p_category = PortfolioCategory::findOrFail($id); | ||
|
||
if ($p_category) { | ||
$p_category->update([ | ||
'status' => 2 | ||
]); | ||
session()->flash('warning', 'Portfolio Category Inactive Successfully!'); | ||
return redirect()->route('portfolio.category.index'); | ||
} | ||
|
||
} | ||
|
||
function active($id){ | ||
$p_category = PortfolioCategory::findOrFail($id); | ||
|
||
if ($p_category) { | ||
$p_category->update([ 'status' => 1 ]); | ||
session()->flash('success', 'Portfolio Category Active Successfully!'); | ||
return redirect()->route('portfolio.category.index'); | ||
} | ||
} | ||
|
||
function destroy($id){ | ||
$p_category = PortfolioCategory::findOrFail($id); | ||
|
||
if ($p_category) { | ||
$p_category->delete(); | ||
session()->flash('danger', 'Portfolio Category Deleted Successfully!'); | ||
return redirect()->route('portfolio.category.index'); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ class Career extends Model | |
'title', | ||
'content', | ||
]; | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,6 @@ class Portfolio extends Model | |
'tool_used', | ||
'client_name', | ||
'client_email', | ||
'work_type', | ||
]; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class PortfolioCategory extends Model | ||
{ | ||
use HasFactory; | ||
protected $fillable=[ | ||
'p_category_name', | ||
'status', | ||
]; | ||
} |
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
33 changes: 33 additions & 0 deletions
33
database/migrations/2020_10_21_062929_create_portfolio_categories_table.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreatePortfolioCategoriesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('portfolio_categories', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('p_category_name'); | ||
$table->tinyInteger('status')->default(1); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('portfolio_categories'); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.