Imgeform.php
<?php
namespace App\Http\Controllers\admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\imagedata;
class imageform extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
return view('admin/image/create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$user = new imagedata();
if($request->hasFile('image1'))
{
//File Name With Extension..
$fileNameWithExt=$request->file('image1')->getClientOriginalName();
//File Name With Out Extension..
$filename=pathinfo($fileNameWithExt,PATHINFO_FILENAME);
//Get Jsut Extension..
$ext=$request->file('image1')->getClientOriginalExtension();
//Final Name..
$fileNameToStore=$filename.'_'.time().'.'.$ext;
$path=$request->file('image1')->storeAs('public/cover_images',$fileNameToStore);
}
else
{
$fileNameToStore="noimage.jpg";
}
$user->image1=$fileNameToStore;
$user->save();
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
EmoticonEmoticon