Я получаю эту ошибку, когда пытаюсь создать навык в своем проекте
Метод App \ Http \ Controllers \ SkillController :: show не существует.
![](https://i.imgur.com/x1OYkMs.png)
Мне не нужен метод show (), потому что мне не нужно представление show моего объекта умения.
Это мой маршрутный маршрут, похожий на
//Skill
Route::get('skill','SkillController@index');
Route::get('skill/create','SkillController@create');
Route::post('skill/store','SkillController@store');
Route::get('skill/{id}/edit', 'SkillController@edit');
Route::post('skill/{id}/update','SkillController@update');
Route::delete('skill/{id}/destroy','SkillController@destroy');
Это весь мой SkillController
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Skill;
use Input, View, File, Image, SSH, Redirect,Response;
class SkillController extends Controller {
public function index(){
$skills = Skill::orderBy('updated_at', 'desc')->orderBy('created_at', 'asc')->where('img_path','==',NULL)->get();
$first_color = $skills[0]->color_code;
$second_color = $skills[1]->color_code;
$third_color = $skills[2]->color_code;
$fourth_color = $skills[3]->color_code;
$fift_color = $skills[4]->color_code;
return View::make('layouts.be.skills.index', get_defined_vars());
}
public function all(){
return Skill::all()->pluck('name');
}
public function create(){
$skillTypes = ['Build System','Development Environment','Server Management','Operating System','IDE','Creative Suite','Video Editing','Package Management','Git Repository','Web Scaffolding','CSS Precompiler','Scripting','Framework','DBMS','Unit Test','Automation Testing','Cloud Platform','Hosting Provider','Content Management', 'API', 'Authentication' , 'Integration','Language','Web Server','Project Managment','Documentation','Utility','Network Analyzer' ];
sort($skillTypes);
return View::make('layouts.be.skills.create', get_defined_vars());
}
public function edit($id){
$skillTypes = ['Build System','Development Environment','Server Management','Operating System','IDE','Creative Suite','Video Editing','Package Management','Git Repository','Web Scaffolding','CSS Precompiler','Scripting','Framework','DBMS','Unit Test','Automation Testing','Cloud Platform','Hosting Provider','Content Management', 'API', 'Authentication' , 'Integration','Language','Web Server','Project Managment','Documentation','Utility','Network Analyzer' ];
sort($skillTypes);
$skill = Skill::findOrFail($id);
return View::make('layouts.be.skills.edit', get_defined_vars());
}
public function store(){
$skill = new Skill;
$skill->type = Input::get('type');
$skill->name = Input::get('name');
$skill->value = Input::get('value');
$skill->color_code = Input::get('color_code');
$skill->save();
if (Input::hasFile('logo_path')) {
$image_path = '/assets/img/skill/';
$path = public_path() . $image_path;
$file = Input::file('logo_path');
$img_name = $skill->id.'.png';
$uploadSuccess = $file->move($path, $img_name);
$file_path = $path . $img_name;
$skill->img_path = $image_path . $img_name;
$crop_file = Image::make($file_path)->fit(20,20);
$crop_file->save($path . 'crop-'.$img_name, 65);
}else {
$skill->img_path = Input::get('logo_path');
}
$skill->save();
return Redirect::to('/skill') ->with('success','The skill was created succesfully!');
}
public function update($id){
$inputs = Input::all();
$skill = Skill::find($id);
$skill->name = Input::get('name');
$skill->type = Input::get('type');
$skill->value = Input::get('value');
$skill->color_code = Input::get('color_code');
$skill->save();
if (Input::hasFile('logo_path')) {
$image_path = '/assets/img/skill/';
$path = public_path() . $image_path;
$file = Input::file('logo_path');
$img_name = $skill->id.'.png';
$uploadSuccess = $file->move($path, $img_name);
$file_path = $path . $img_name;
$skill->img_path = $image_path . $img_name;
$crop_file = Image::make($file_path)->fit(20,20);
$crop_file->save($path . 'crop-'.$img_name, 65);
} else {
$skill->img_path = Input::get('logo_path');
}
$skill->save();
return Redirect::to('/skill') ->with('success','The skill was updated succesfully!');
}
public function destroy($id){
$skill = Skill::find($id);
$skill->delete();
$image_path = '/assets/img/skill/';
$path = public_path() . $image_path;
File::deleteDirectory($path);
return Redirect::to('/skill') ->with('success','The skill was deleted succesfully!');
}
public function skilldata(Request $request){
$skill = str_replace("-"," ",$request->skill);
$data = Skill::where(DB::raw('LOWER(type)'),'=',$skill)->get();
return response()->json($data, 200);
}
}
Я также пробовал эти 2 команды уже
┌──[root@bheng]──[/home/forge/bheng]
└── php artisan cache:clear
Application cache cleared!
┌──[root@bheng]──[/home/forge/bheng]
└── composer dumpauto
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: nesbot/carbon
Discovered Package: laravel/slack-notification-channel
Discovered Package: laravel/nexmo-notification-channel
Discovered Package: laravelcollective/remote
Discovered Package: htmlmin/htmlmin
Discovered Package: intervention/image
Discovered Package: laravelcollective/html
Package manifest generated successfully.
You have new mail in /var/mail/root
┌──[root@bheng]──[/home/forge/bheng]
└──
skill.create.blade.php
@extends('layouts.be.master')
@section('content')
<div class="card-body card-padding">
<div class="row">
{!! Form::open(array('class' => 'form-horizontal', 'role' =>'form', 'url'=>'skill/store','files' => true)) !!}
<div class="col-sm-4">
{{-- Name --}}
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" value="{{Request::old('name')}}" value="" name="name" class="form-control" id="name" placeholder="Name">
</div>
</div>
{{-- Type --}}
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Type</label>
<div class="col-sm-10">
<select name="type" class="form-control">
@foreach($skillTypes as $item)
<option value="{{ $item }}">{{ $item }}</option>
@endforeach
</select>
</div>
</div>
{{-- Value --}}
<div class="form-group">
<label class="col-sm-2 control-label">Value</label>
<div class="col-sm-8">
<br>
<input type="range" id="range-value" value="93" name="value">
</div>
<div class="col-sm-2">
<h3 id="text-value"></h3>
</div>
</div>
{{-- Color --}}
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Color</label>
<div class="col-sm-2">
<input type="color" name="color_code" class="form-control" placeholder="Color" id="example-color-input">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<a class="btn btn-default" href="/skill"> Cancel </a>
<button type="submit" class="btn btn-info">Create</button>
</div>
</div>
</div>
<div class="col-sm-8">
{{-- Icon --}}
<div class="form-group">
<label class="col-sm-2 control-label" >Icon</label>
<div class="col-sm-10">
<img name="logo_path" id="skill-icon" width="300px"><br><br>
<input type="file" class="form-control" name="logo_path" aria-describedby="fileHelp">
</div>
<label class="col-sm-2 control-label" >Icon URL </label>
<div class="col-sm-10">
<input id="url-logo" name="logo_path" type="text" class="form-control">
</div>
</div>
</div>
{!!Form::close()!!}
</div>
</div>
@stop
@section('custom-scripts')
<script type="text/javascript" src="/js/Vibrant.js"></script>
<script type="text/javascript">
function readLogo(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#skill-icon').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
// Update media preview with base64 image
$( "input[name*='logo_path']" ).change(function(){
readLogo(this);
});
$( "#url-logo" ).on('keyup',function(){
$('#skill-icon').attr('src', $( "#url-logo" ).val());
});
$('#text-value').text($('#range-value').val());
$('#range-value').change(function(){
$('#text-value').text($('#range-value').val());
});
// Icon
var icon = $('#skill-icon');
icon.attr('src', $( "#url-logo" ).val());
$( "#url-logo" ).on('keyup',function(){
var vibrant = new Vibrant(icon[0]);
var swatches = vibrant.swatches()
for (var swatch in swatches)
if (swatches.hasOwnProperty(swatch) && swatches[swatch])
// console.log(swatches[swatch].getHex());
var color = swatches[swatch].getHex();
$( "input[name*='color_code']" ).val(color)
console.log('%c >>>>>>>>>>>>>>', "color:" + String(color) + ";");
console.log('color',color);
// Vibrant #3c62ac
// Muted #7484ab
// DarkVibrant #345cab
// DarkMuted #101010
// LightVibrant #849ccc
});
</script>
@stop
Пожалуйста, дайте мне знать, если вы заметите что-то, что я не должен делать.